Dear all,
I am trying to compile with the latest Intel compiler (version 16.0.3) a very simple code in which an OpenMP v4.x user defined reduction is offloaded to a MIC.
Here is the code (attached to the post, for your convenience):
#pragma offload_attribute (push,target(mic))
#include <stdio.h>
typedef struct
{
double real;
double imag;
} complex_t;
complex_t
complex_add (complex_t a, complex_t b)
{
complex_t c;
c.real = a.real + b.real;
c.imag = a.imag + b.imag;
return c;
}
#pragma offload_attribute (pop)
int
main ()
{
complex_t x;
#pragma omp declare reduction(cmplxAdd: complex_t: omp_out=complex_add(omp_out, omp_in)) initializer( omp_priv={0.0, 0.0} )
#pragma offload target(mic) out(x)
{
x = (complex_t) {0.0, 0.0};
#pragma omp parallel num_threads(48) reduction(cmplxAdd: x)
{
x = (complex_t) {1.0, -1.0};
}
}
printf ("Done: result is %f,%f\n", x.real, x.imag);
}
The code is compiled using
icc -O3 -qopenmp -o mytest mytest.c
The compiler fails, producing the following error message:
/tmp/iccI8DGFd.o: In function `main':
main.c:(.text+0x199): undefined reference to `__udr_i_0x4633c48'
main.c:(.text+0x1d6): undefined reference to `__udr_c_0x4633658'
If I understand correctly, the first undefined reference is for the user defined reduction initializer, and the second one for the user defined reduction combiner (the reduction function). However, searching the Internet for related documentation I was not able to find anything about. What should I do to properly compile the code ? Am I missing linking one or more specific libraries ?
Thank you in advance for your kind assistance.
Massimo Cafaro