c++ - PGI 不支持 OpenMP 4.5 运行时函数

标签 c++ openmp pgi offloading

当我尝试编译以下代码时

#include <omp.h>
#include <stdio.h>
#include <accel.h>

int main (void) {
  int sum = 0;

  #pragma omp target teams distribute parallel for reduction(+:sum) defaultmap(tofrom:scalar)
  for(int i = 0 ; i < 2000000000; i++) {
    sum += i%11;
  }

  printf("sum = %d\n",sum);

  printf("devices %d\n", omp_get_num_devices());
  printf("default device %d\n", omp_get_default_device());
  printf("device id %d\n", omp_get_initial_device());
  return 0;
}

pgc++ -mp foo.cpp

我收到错误

error: identifier "omp_get_num_devices" is undefined

其余 OpenMP 运行时函数也未定义。该代码使用 gcc7 可以正常编译。 PGI 17.10 社区版编译器支持这些函数吗?根据他们的网站,PGI 17.10 社区版编译器支持 OpenMP 4.5。我做错了什么?

我在 Ubuntu 16.04 和 17.04 上尝试过此操作。

最佳答案

PGI added support for the tasking, binding, SIMD, synchronization, reduction, atomic and other CPU features for Linux/OpenPOWER CPUs in 17.7. These features are supported in the 18.1 release of the PGI LLVM compilers for Linux x86-64. PGI is planning to start working on the OpenMP 4.x target features in 2018.

更多详细信息:https://www.pgroup.com/resources/accel.htm#openmp

关于c++ - PGI 不支持 OpenMP 4.5 运行时函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49322080/

相关文章:

c++ - 我将如何水平打印更多 block ?

c++ - C/C++ 中的日常文件维护工作

c++ - 每次执行时,OpenACC 总和减少输出递增总和

c++ - const char* 在平行区域内改变它的值

c++ - 为什么我得到 Present table dump for device[1] : NVIDIA Tesla GPU 0 in this code?

c++ - 在 #ifdef 中使用 OR

dependencies - OpenMP : communicating values between threads 中的并行累积(前缀)总和

loops - 控制并行循环中的线程数并减少开销

pgi - 获取 PGI 编译器的状态