Showing results for 
Search instead for 
Did you mean: 

OpenMP 4.0 target directives

I tried to get an OpenMP 4.0 test case to run where the code calls a user library that is compiled for host and mic (-mmic)

The host library is in current directory (pwd), the MIC lib is in pwd/mic and I set LD_LIBRARY_PATH to pwd and MIC_LD_LIBRARY_PATH to pwd/mic

However the execution fails with "On the sink, dlopen() returned NULL. The result of dlerror() is "/tmp/coi_procs/1/31669/load_lib/iccoutysEa1j: undefined symbol: foo"

Code look like this:

#include <omp.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include "foo.h"

#pragma omp declare target
int foo();
#pragma omp end declare target

int main()
  /* start user code */
#pragma omp target
  return 0;

Command line is:

icc -shared -fPIC -o hostlib.c
icc -mmic -shared -fPIC -o mic/ hostlib.c
icc -openmp -o test_mic.o -c test_mic.c
icc -openmp -L. -lhostlib -o test_mic test_mic.o

Why isn't this working?


0 Kudos
1 Reply

Of course the topic title should be "...OpenMP 4.0 target directives ..." but I cannot edit.