Developer Guide and Reference

Contents

GAP Message (Diagnostic ID 30528)

Message

Add "%s" to the declaration of routine "%s" in order to parallelize the loop at line %d. Adding "%s" achieves a similar effect.

Advice

Confirm that the routine specified is indeed
a const function
or
a concurrency-safe function
before following the advice to add the annotation.
If the routine is not one of these kinds of functions, try to inline it with
#pragma forceinline recursive
. This action may or may not be beneficial.
Example
Consider the following:
#define N 10000 double A[N], B[N]; int bar(int); void foo(){ int i; for (i=0;i<N;i++){ A[i] = B[i] * bar(i); } }
In this case,
the compiler does not parallelize the loop because it is not safe to do so without further information about routine
bar
, which is being called
.
If you determine it is safe to do so,
you can add the pragma
as follows:
#define N 10000 double A[N], B[N]; void foo(){ int i; #pragma forceinline recursive for (i=0;i<N;i++){ A[i] = B[i] * bar(i); } }

Verify

Confirm that the routine satisfies the semantics of this declaration. Another way to help the loop being parallelized is to inline the routine with the
forceinline recursive pragma
, but this method does not guarantee parallelization.