IBM Support

How to list privatized shared variables in an automatic parallel loop

Troubleshooting


Problem

Use -qreport to get a listing of privatized shared variables in an automatic parallel loop. -qinfo=private does not list privatized shared variables in a parallel loop.

Symptom


The Compiler Reference manual mentions that -qinfo=private can be used to report privatized shared variables in a parallel loop.

Compile the following test case with:
$ xlc_r a.c -qsmp -qinfo=private

Variables "a" and "b" were privatized but there was no message about variables "a" or "b" being privatized.

How can one list what shared variables are privatized by the compiler?

$cat -n a.c
1 int main() {
2 int a,b = 10000;
3 int i,j = 0;
4 #pragma omp parallel for private(a) /* user parallelization */
5 for (i=0; i<10000; i++) {
6 a = i * 100 + 3;
7 }
8 /* automatic parallelization */
9 for (j=0; j<10000; j++) {
10 b = j * 100 + 3;
11 }
12 printf("a=%d\n", a);
13 printf("b=%d\n", b);
14 return 0;
15 }

Resolving The Problem


The information of -qinfo=private in the manual was incorrect. Users should use -qreport instead to get a listing of privatized shared variable in an automatically parallelized loop.

$xlc_r a.c -qsmp -qreport
"a.c", line 5: 1586-358 (I) Loop was parallelized.
"a.c", line 9: 1586-358 (I) Loop was parallelized.

There are two types of parallelization: user parallelization and automatic compiler parallelization. User parallelization is triggered by the presence in the program source code of OpenMP directives (such as #pragma omp) while automatic parallelization is driven by the compiler.

a) In the case of user parallelization, the -qreport option causes the compiler to generate a report indicating which loops are considered as parallel loops. If a loop is parallelized, all the variables specified by the OpenMP standard as private, explicitly or implicitly, will be privatized. The compiler does not report which variables are privatized because the use of OpenMP directive in the source code is self explanatory. In the above example, "a" is in a user specified parallel loop, so the compiler reports the loop being parallelized, but does not report variable "a" being privatized.

b) In the case of automatic parallelization, in addition to reporting which loops are considered as parallel loops, the -qreport option generates a report indicating which variable the compiler considers as private for the purpose of parallelization. In the above example, "b" is in an automatically parallelized loop, the -qreport option reports the loop being parallelized, and produces a listing file (a.lst) containing the following information:


Source Source Loop Id Action / Information
File Line
------ ------- -------- ------------------------------------------------
0 9 1 Private variables recognized in this loop nest:
"b", and "b".
0 9 1 Loop has been automatically parallelized.


The compiler reports that variable "b" is privatized in the compiler-driven automatic parallelized loop.

[{"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":"Compiler","Platform":[{"code":"PF002","label":"AIX"}],"Version":"7.0;8.0;9.0;10.1","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
08 August 2018

UID

swg21326216