Loop2 (source):
all directives start with !$OMP
basic construction: parallel region
-
PARALLEL / END PARALLEL
-
fork/join, barrier at exit
-
distribution of work with DO
(optional END DO)
-
index range 1..n partitioned into blocks and distributed to threads
loop counters i and j automatically private
-
all loop indices inside of PARALLEL region (lexically = without subroutines)
other variables shared (a, v, work)
-
no problem with a, work (read only)
-
ok with v (all threads write at different indices)
function call works (f has no side effects),
-
local variables of f are private
compiler doesn't check independance of loop iterations!