User`s guide
Cray XMT™ Programming Environment User’s Guide
variable to be updated must occur as the target on the left side of the
statement and must occur exactly once as a subexpression on the
right side of the statement. For example,
void update_example(double A[], int i, int j){
extern double V;
extern double X;
// This is allowed
#pragma mta update
V = 1.0 + X + 3.0*V;
// This is allowed
#pragma mta update
A[i] = A[i] + A[j];
// But this is not allowed
#pragma mta update
A[i] = A[i] + A[i]; // compiler reports an error
}
This directive applies to the next statement only.
The following four directives control how the compiler parallelizes the loop that
immediately follows.
#pragma mta block schedule
When this directive appears before a loop that the compiler
parallelizes, each thread assigned to the execution of the loop
performs a contiguous subset of the total iterations. Each thread
executes the same number of iterations, within 1. For example, if
100 iterations are performed by 20 threads, the first thread executes
the first 5 iterations of the loop, the second thread executes the next
5 iterations, and so forth.
#pragma mta block dynamic schedule
This scheduling method combines aspects of both block and dynamic
scheduling. At execution time, threads are assigned one block
of iterations at a time through the use of a shared counter. After
completing an assigned block, each thread receives its next block
by accessing the counter. The number of blocks executed by each
thread depends on the execution time of the particular iterations in
the blocks assigned to the thread.
#pragma mta interleave schedule
When this directive appears before a loop that the compiler
parallelizes, each thread assigned to the execution of the loop
performs a subsequence of the total iterations, where the members
of the subsequence are regularly spaced. Each thread executes the
same number of iterations, within 1. For example, if 100 iterations
122 S–2479–20