当我尝试编译以下代码时
#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.
关于c++ - PGI 不支持 OpenMP 4.5 运行时函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49322080/