Why use #pragma acc region ?

pgcc -m32 -lm -lrt -g -O4 -o grab_pgcc_mod xxx xxxx xxxx -Mconcur=innermost -fast -Mipa -Mipa=safe:clock_gettime -Minfo=accel -Mneginfo -ta=nvidia,time -Mipa=inline -Mprof=lines


Above is the command that I use to compile a program. I have left out the files’s names that I use becuase they are really unimportant in this question.

I use the command

#pragma acc region

in two subprograms of the software program which has 55 subprograms, the rest of the subprorams are compiled by the command line shown above.

In the #pragma-less subprograms there are kernels generated on compilation. For some reason there are no kernels where I have the two #pragma commands. These loops cannot be vectorized or parallelized. I understand that accelerator region is ignored; but many loops are vectorized and they do not have a

#pragma acc region

command preceeding them.

Except for specific directives why do we use the #pragma command at all?
The compiler command line seems to handle everything. I will grant you thta it is general and not specific commands, but that is the only reason thta I can see…

THX 1138

Hi THX 1138,

Pragmas are in the C standard as a way to give the compiler additional information that can’t always be determined from the source code itself. The extend and use of pragmas will vary by compiler depending upon it’s capabilities.

For example, the auto-parallelization optimization can automatically add OpenMP parallel regions, but not all compilers have this capability. Also, some users prefer to have more explicit control of how the compiler parallelizes the code so will instead use OpenMP pragmas.

For the PGI Accelerator model, there currently isn’t an automatic way for the compiler to off-load code to an Accelerator. Hence users must use pragmas to define the regions of code explicitly.

  • Mat

Okay, but I have seen several kernels generated and when I run the program with ACC_NOTIFY=1, I get no message that the kernels were ever entered. Note they are not preceeded by

#pragma acc region

So they must only be guided by the command line options and I know that they are entered (so many of them, the program cannot skip over all of them). But, I get nothing.

Also, where in the literature does in talk about inlining functions and the levels it can go to. I know it is there, but i cannot seems to find it.

THX 1138

Hi THX 1138,

If you don’t have a “#pragma acc region” then no accelerator region will be generated. Perhaps you are misreading the -Minfo messages? Since you have auto-parallelization enabled (-Mconcur) the messages could be telling you that an OpenMP parallel region was created.

Also, where in the literature does in talk about inlining functions and the levels it can go to. I know it is there, but i cannot seems to find it.

See Chapter 4 of the PGI User’s guide: http://www.pgroup.com/doc/pgiug.pdf. In particular, find the description of the “levels” sub-option. (Currently on page 50)

  • Mat