gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-10-31 02:07:00 24 4
gpt4 key购买 nike

当我尝试编译以下代码时

#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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com