我的macOS是10.12.4,我已经在我的macbook上安装了PGI(只需通过从PGI官网下载的安装程序安装,激活自己的控制台,没有其他操作,在这个控制台中,有类似“pgcc pgc++和等等”),版本是 16.10,我用 CLion 编辑了一个测试代码:
#include <iostream>
#ifdef _OPENACC
#include <openacc.h>
#endif
using namespace std;
int main() {
#ifdef _OPENACC
//part 1
cout<<acc_get_num_devices(acc_device_not_host)<<endl;
//part2
// const int N = 1024;
// //定义
// int i, a[N], b[N], c[N];
//
// for (i = 0; i < N; i++) {
// c[i] = 0;
// a[i] = b[i] = i;
// }
//
//#pragma acc kernels
// for (i = 0; i < N; i++) {
// c[i] = b[i] + a[i];
// }
// std::cout << c[1] << std::endl;
#else
cout << "not support OpenACC" << endl;
#endif
return 0;
}
当我编译它时,我遇到了一些问题:
MacBook13:TestOpenCV Chen$ pgc++ -acc -std=c++11 -Minfo main.cpp
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
/usr/bin/../include/c++/v1/__tuple", line 93: error: pair is not a
template
template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
^
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
/usr/bin/../include/c++/v1/__tuple", line 97: error: pair is not a
template
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
^
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
/usr/bin/../include/c++/v1/__tuple", line 98: error: pair is not a
template
get(pair<_T1, _T2>&) _NOEXCEPT;
^
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
/usr/bin/../include/c++/v1/__tuple", line 102: error: pair is not a
template
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
^
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
/usr/bin/../include/c++/v1/__tuple", line 103: error: pair is not a
template
get(const pair<_T1, _T2>&) _NOEXCEPT;
^
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
/usr/bin/../include/c++/v1/__tuple", line 108: error: pair is not a
template
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
^
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
/usr/bin/../include/c++/v1/__tuple", line 109: error: pair is not a
template
get(pair<_T1, _T2>&&) _NOEXCEPT;
^
7 errors detected in the compilation of "main.cpp".
并且无论使用 pgc++ 执行哪个部分(第 1 部分或第 2 部分),错误信息可能是相同的,我不知道从哪里开始解决这个问题,我是 macbook 上的新手,真的希望你帮助~