libgomp: Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses
1
1 9.8 Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses
1 ========================================================================
1
1 This seems simple enough for PARALLEL blocks. Create a private struct
1 for communicating between the parent and subfunction. In the parent,
1 copy in values for scalar and "small" structs; copy in addresses for
1 others TREE_ADDRESSABLE types. In the subfunction, copy the value into
1 the local variable.
1
1 It is not clear what to do with bare FOR or SECTION blocks. The only
1 thing I can figure is that we do something like:
1
1 #pragma omp for firstprivate(x) lastprivate(y)
1 for (int i = 0; i < n; ++i)
1 body;
1
1 which becomes
1
1 {
1 int x = x, y;
1
1 // for stuff
1
1 if (i == n)
1 y = y;
1 }
1
1 where the "x=x" and "y=y" assignments actually have different uids
1 for the two variables, i.e. not something you could write directly in
1 C. Presumably this only makes sense if the "outer" x and y are global
1 variables.
1
1 COPYPRIVATE would work the same way, except the structure broadcast
1 would have to happen via SINGLE machinery instead.
1