
Chapter 6. C and C++ programming 59
symmetric
The symmetric directive declares that an auto or register variable has
the same local address on all processing elements (PEs). This is useful
for global addressing using the SHMEM library functions. The format
for this compiler directive is:
#pragma _CRI symmetric var...
The symmetric directive must appear in local scope. Each variable listed
on the directive must:
• be declared in the same scope as the directive
• have auto or register storage class
• not be a function parameter.
Because all PEs must participate in the allocation of symmetric stack
variables, there is an implicit barrier before the first executable state-
ment in a block containing symmetric variables.
unroll
The unroll directive allows the user to control unrolling for individual
loops. Loop unrolling can improve program performance by revealing
memory optimization opportunities such as read-after-write and read-
after-read. The effects of loop unrolling also include:
• an improved loop scheduling by increasing the basic block size
• a reduced loop overhead
• improved chances for cache hits.
The format for this compiler directive is:
#pragma _CRI unroll [n]
Item n specifies the total number of loop body copies to be generated.
The value of n must be in the range of 2 through 64. If you do not
specify a value for n, the compiler attempts to determine the number of
copies to be generated based on the number of statements in the loop
nest.
Warning: If placed prior to a non-innermost loop, the unroll directive
asserts that the following loop has no dependencies across iterations of
that loop. If dependencies exist, incorrect code could be generated.
The unroll compiler directive can be used only on loops whose iteration
counts can be calculated before entering the loop.
Komentarze do niniejszej Instrukcji