Parallel Java ForLoop model element

PJForLoop defines a for loop of integer or long index that runs in parallel on a shared memory parallel (SMP) computer

The element encapsulates access to both IntegerForLoop and LongForLoop in the Parallel Java library.

Usage

To add a PJForLoop element to your model, drag the icon element to the list of your model elements and edit it to select the number of processors to use, the index range, the scheduling policy, and to enter the code for each of the parts of your parallel for loop.

The element implements the following basic methods:

Example of use

pjForLoop.execute(4); // runs the parallel loop using 4 threads 
pjForLoop.execute(0); // runs the parallel loop using the default number of threads
_println ("The loop executed on "+pjForLoop.getThreadCount()+" threads,");
_println ("and took "+pjForLoop.getExecutionTime()+" milliseconds.");