Quantcast
Channel: Intel® Many Integrated Core Architecture
Viewing all articles
Browse latest Browse all 1347

Using OpenMP 4.0 target directives with user libraries

$
0
0

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"

The code looks 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
    {
      foo();
    }
  return 0;
}

Command line is:

icc -shared -fPIC -o libhostlib.so hostlib.c

icc -mmic -shared -fPIC -o mic/libhostlib.so hostlib.c

icc -openmp -o test_mic.o -c test_mic.c

icc -openmp -L. -lhostlib -o test_mic test_mic.o

How can I get something like this to work or is it just impossible to use custom libraries on the target with the offload model?


Viewing all articles
Browse latest Browse all 1347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>