Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #4906

My efficient Threadpool engine with priorities that scales very well was updated to version 3.7

From Horizon68 <horizon@horizon.com>
Newsgroups comp.programming.threads
Subject My efficient Threadpool engine with priorities that scales very well was updated to version 3.7
Date 2019-01-24 15:57 -0800
Organization A noiseless patient Spider
Message-ID <q2djd6$1vl$6@dont-email.me> (permalink)

Show all headers | View raw


Hello...


My efficient Threadpool engine with priorities that scales very well was 
updated to version 3.7

ParallelFor() now supports grainsize, please read the following about
grainsize:


procedure ParallelFor(nMin, nMax:integer;aProc: 
TParallelProc;GrainSize:integer=1;Ptr:pointer=nil;pmode:TParallelMode=pmBlocking;Priority:TPriorities=NORMAL_PRIORITY); 


nMin and nMax parameters of the ParallelFor() are the minimum and 
maximum integer values of the variable of the ParallelFor() loop, aProc 
parameter of ParallelFor() is the procedure to call, and GrainSize 
integer parameter of ParallelFor() is the following:

The grainsize sets a minimum threshold for parallelization.

A rule of thumb is that grainsize iterations should take at least 
100,000 clock cycles to execute.

For example, if a single iteration takes 100 clocks, then the grainsize 
needs to be at least 1000 iterations. When in doubt, do the following 
experiment:

1- Set the grainsize parameter higher than necessary. The grainsize is 
specified in units of loop iterations.
If you have no idea of how many clock cycles an iteration might take, 
start with grainsize=100,000.

The rationale is that each iteration normally requires at least one 
clock per iteration. In most cases,
step 3 will guide you to a much smaller value.

2- Run your algorithm.

3- Iteratively halve the grainsize parameter and see how much the 
algorithm slows down or speeds up
as the value decreases.

A drawback of setting a grainsize too high is that it can reduce 
parallelism. For example, if the grainsize is 1000 and the loop has 2000 
iterations, the ParallelFor() method distributes
the loop across only two processors, even if more are available.

And you can pass a parameter in Ptr as pointer to ParallelFor(), and you 
can set pmode parameter of to pmBlocking so that ParallelFor() is 
blocking or to pmNonBlocking so that ParallelFor() is non-blocking, and 
the Priority parameter is the priority of ParallelFor(). Look inside the 
test.pas example to see how to use it.


You can download it from:

https://sites.google.com/site/scalable68/an-efficient-threadpool-engine-with-priorities-that-scales-very-well


Thank you,
Amine Moulay Ramdane.

Back to comp.programming.threads | Previous | Next | Find similar | Unroll thread


Thread

My efficient Threadpool engine with priorities that scales very well was updated to version 3.7 Horizon68 <horizon@horizon.com> - 2019-01-24 15:57 -0800

csiph-web