Results of OpenMP target directives on PGI

2019-08-03 19:17发布

问题:

I'm using PGI to compile the following program which uses OpenMP's target directives to offload work to a GPU:

#include <iostream>
#include <cmath>

int main(){
  const int SIZE = 400000;

  double *m;
  m = new double[SIZE];

  #pragma omp target teams distribute parallel for
  for(int i=0;i<SIZE;i++)
    m[i] = std::sin((double)i);

  for(int i=0;i<SIZE;i++)
    std::cout<<m[i]<<"\n";
}

My compilation string is as follows:

pgc++ -omp -ta=tesla,pinned,cc60 -Minfo=accel  -fast test2.cpp

Compilation succeeds, but it lacks the series of outputs that I get with OpenACC that tell me what the compiler actually did with the directive, like so:

main:
  8, Accelerator kernel generated
     Generating Tesla code
     11, #pragma acc loop gang, vector(128) /* blockIdx.x threadIdx.x */
  8, Generating implicit copyout(m[:400000])

How can I get similar information for OpenMP? -Minfo by itself didn't seem to yield anything useful.

回答1:

"-Minfo" (which is the same as "-Minfo=all"), or "-Minfo=mp" will give you compiler feedback messages for OpenMP compilation.

Though, PGI only supports OpenMP 4.5 directives with our LLVM back-end compilers. These are available by default on IBM Power based systems or as a part of our LLVM beta compilers on x86. The x86 beta compilers can be found at http://www.pgroup.com/support/download_llvm.php but do require a Professional Edition license.

Also, our current OpenMP 4.5 only targets multicore CPU. We're working on GPU target offload as well but this support wont be available for awhile.



标签: c++ openmp pgi