我想测试xeon phi的SIMD内在函数。所以我写了以下代码:
#pragma offload target(mic) in(a:length(N))
#pragma omp parallel for
for(int i=0;i<16;++i){
__m512i p ;
p = _mm512_loadunpackhi_epi64(p, &a[i*10]);
}
编译时,icpc
给了我未定义的引用错误
/tmp/icpc3kLMRg.o: In function `main':
./src/test.cc:(.text+0x2e8): undefined reference to `_mm512_extloadunpackhi_epi64'
make: *** [test.cc] Error 1
除了immintrin.h
答案 0 :(得分:2)
编译器为主机和xeon phi编译。主机不支持您尝试呼叫的功能,因此您需要执行此操作:
#ifdef __MIC__
#pragma offload target(mic) in(a:length(N))
#pragma omp parallel for
for(int i=0;i<16;++i){
__m512i p ;
p = _mm512_loadunpackhi_epi64(p, &a[i*10]);
}
#else
<do something differnt on the host (or nothing)>
#endif