PDC
PDC
PDC
The main thread that encounters this directive becomes master of this group and has
thead id 0 within the group.
default(none) forces us to specify data handlers for all variable that we want to
pass.
Scheduling
Iterations are divided into chunks that are approximately equal in size and it
distributes at most one chunk to each thread.
One chunk will include iteration n-m (for example 0-4).
These chunks are assigned to threads which is defined by the type of scheduling we
are performing.
--> Static assigns the chunks in the round-robin manner (in-order execution). (each
thread will get the same number of iterations except one if odd)
--> Dynamic assigns the chunks in first-come first-served manner, as the threads
finish their work they ask for more work if it isn't finished.
--> Guided assigns in first-come first-served manner, but the chunk-size starts
large then shrinks to the provided size.
--> Auto is on the compiler to decide.
--> Runtime is when the scheduling and chunksize is defined at runtime.
For iterations that take roughly equal time, Static is the best due to little
overhead.
For iterations that vary in time, Dynamic works the best.
Dynamic Overhead: After each iteration, the threads must stop and receive a new
value of the loop
variable to use for its next iteration.
If we increase chunk-size it'll get closer to being static and it won't have to
reassign new values very quickly.
This is where guided works better because chunksize is large initially.