I want to test the SIMD intrinsic of xeon phi. So I wrote following code:

#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]);
}

When compiling, icpc gave me undefined reference error

/tmp/icpc3kLMRg.o: In function `main':
./src/test.cc:(.text+0x2e8): undefined reference to `_mm512_extloadunpackhi_epi64'
make: *** [test.cc] Error 1

Is there any other header files to be included besides immintrin.h

有帮助吗?

解决方案

The compiler compiles for the host as well as for the xeon phi. The host doesn't support the function you are trying to call so you need to do this:

#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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top