Software Archive
Read-only legacy content
17061 Discussions

undefined reference to `_mm512_set1_ps'

Alexander_Komarov
654 Views

Hi there, 

I compile this program for test Xeon Phi:
 

#pragma offload_attribute(push,target(mic))

#include <stdio.h>
#include "immintrin.h"

void sub()
{
__m512 v1 = _mm512_set1_ps(1.2);
__m512 v2 = _mm512_set1_ps(1.1);
v1 = _mm512_add_ps(v1, v2);
float out[16];
_mm512_store_ps(&out[0], v1);
printf("%.1f %.f %.f %.f\n", out[0], out[1], out[2], out[3]);
fflush(0);
}

#pragma offload_attribute(pop)

int main(int argc, char* argv[])
{
printf("hello from main\n");
#pragma offload target(mic)
sub();
}

I get  error of compile:

icc tbo_sort.o -openmp -o tbo_sort.out
tbo_sort.o: In function `main':
tbo_sort.c:(.text+0x53): undefined reference to `_mm512_set1_ps'
tbo_sort.c:(.text+0x68): undefined reference to `_mm512_set1_ps'
tbo_sort.c:(.text+0xee): undefined reference to `_mm512_add_ps'
tbo_sort.c:(.text+0x132): undefined reference to `_mm512_store_ps'
tbo_sort.o: In function `sub':
tbo_sort.c:(.text+0x1b2): undefined reference to `_mm512_set1_ps'
tbo_sort.c:(.text+0x1c7): undefined reference to `_mm512_set1_ps'
tbo_sort.c:(.text+0x24d): undefined reference to `_mm512_add_ps'
tbo_sort.c:(.text+0x291): undefined reference to `_mm512_store_ps'
make: *** [tbo_sort.out] Error 1

Thanks,

Alexander

 

0 Kudos
2 Replies
Kevin_D_Intel
Employee
654 Views

You must protect the compilation of the intrinsics using __MIC__ in sub(). Have a look at this earlier thread http://software.intel.com/en-us/comment/1726413#comment-1726413

0 Kudos
Alexander_Komarov
654 Views

Thank you very much.

0 Kudos
Reply