- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I revised my earlier reply to match all the names you used.
Try building and running like this:
icc -openmp -fpic -shared -o libhostlib.so hostlib.c icc -openmp -fpic -mmic -shared -o mic/libhostlib.so hostlib.c icc -openmp -L. -lhostlib -otest_mic test_mic.c -offload-option,mic,ld,"-L./mic -lhostlib" export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. export MIC_LD_LIBRARY_PATH=$MIC_LD_LIBRARY_PATH:./mic ./test_mic
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I revised my earlier reply to match all the names you used.
Try building and running like this:
icc -openmp -fpic -shared -o libhostlib.so hostlib.c icc -openmp -fpic -mmic -shared -o mic/libhostlib.so hostlib.c icc -openmp -L. -lhostlib -otest_mic test_mic.c -offload-option,mic,ld,"-L./mic -lhostlib" export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. export MIC_LD_LIBRARY_PATH=$MIC_LD_LIBRARY_PATH:./mic ./test_mic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This does indeed work.
Thanks for that!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great! Thank you for useful question/post. I expect it will help others in the future.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page