【问题标题】:Results of OpenMP target directives on PGIPGI 上 OpenMP 目标指令的结果
【发布时间】:2017-12-27 00:04:31
【问题描述】:

我正在使用 PGI 编译以下程序,该程序使用 OpenMP 的目标指令将工作卸载到 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";
}

我的编译字符串如下:

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

编译成功,但它缺少我使用 OpenACC 获得的一系列输出,这些输出告诉我编译器对指令实际做了什么,如下所示:

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])

如何获取 OpenMP 的类似信息? -Minfo 本身似乎并没有产生任何有用的东西。

【问题讨论】:

    标签: c++ openmp pgi


    【解决方案1】:

    “-Minfo”(与“-Minfo=all”相同)或“-Minfo=mp”将为您提供 OpenMP 编译的编译器反馈消息。

    不过,PGI 仅支持使用我们的 LLVM 后端编译器的 OpenMP 4.5 指令。这些默认情况下在基于 IBM Power 的系统上可用,或者作为我们在 x86 上的 LLVM beta 编译器的一部分。 x86 beta 编译器可以在http://www.pgroup.com/support/download_llvm.php 找到,但需要专业版许可证。

    此外,我们当前的 OpenMP 4.5 仅针对多核 CPU。我们也在致力于 GPU 目标卸载,但暂时不会提供此支持。

    【讨论】:

    • 谢谢!我一直在寻找使用 OpenMP 4.5 来对我的 GPU 进行更细粒度的控制。它似乎还没有在任何编译器上得到很好的支持:-/
    猜你喜欢
    • 2023-04-01
    • 2011-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-28
    • 1970-01-01
    • 2012-06-20
    相关资源
    最近更新 更多