Using MKL inside #pragma offload region

Using MKL inside #pragma offload region


      I have problems with the exact same thing every time - linking with MKL when using compiler assisted offload.

1. When I build offloaded code that does not make any MKL calls in the offloaded region, I compile with -DMKL_ILP64 -mkl=sequential and link with -lpthread -lm as recommended by Ver 4 of the Link Line advisor located here - I know that I'm running the sequential

2. Now when I include MKL calls (to DFTI descriptor configuration) in the offloaded region, I compile with -DMKL_ILP64 -mkl=sequential and link with -lpthread -lm i.e. the same compiler and linking options used when there was no MKL code in the offloaded regions. When i run my code, I get the following error -

offload error: process on the device 0 was terminated by signal 11 (SIGSEGV)

3. Using Ver 4 of the Link Line advisor located here -, I select the following options -

  • Select Intel® product: Intel Composer XE 2013 SP1
  • Select OS: Linux
  • Select usage model of Intel® Xeon Phi™ Coprocessor: Compiler assisted Offload
  • Select compiler: Intel C/C++
  • Select architecture: Intel 64
  • Select dynamic or static linking: Dynamic
  • Select Interface Layer: ILP64 (64-bit Integer)
  • Select sequential or multi-threaded layer: Sequential


My Link Line I compile with -DMKL_ILP64 -mkl=sequential -offload-attribute-target=mic, and link with -lpthread -lm.

On the sink, dlopen() returned NULL. The result of dlerror() is "/tmp/coi_procs/1/5217/load_lib/icpcoutBZOw1k: undefined symbol: _ZN9KeplerObj11getRedShiftEv"
On the remote process, dlopen() failed. The error message sent back from the sink is /tmp/coi_procs/1/5217/load_lib/icpcoutBZOw1k: undefined symbol: _ZN9KeplerObj11getRedShiftEv
offload error: cannot load library to the device 0 (error code 20)

From my understanding of what the flag -offload-attribute-target=mic does, it marks every function and variable in the source file as offload-able!!! ( Correct me if I am wrong, but that is not the compiler option for me simply because I have C++ classes etc in my code (not meant to be offloaded) that are not supported for offload by #pragma offload {}. Now based on Kevin Davis's article - 'Effective Use of the intel Compiler's Offload Feature' (, based on my reading of the section on 'Using MKL and TBB on MIC', my using the -DMKL_ILP64 flag should be enough to make the compiler build MIC versions of my MKL code. So what's the problem? Could it be my MPSS? My MKL version? My compiler version?

I have tried many variants of the linking but while i can get simple code to compile and run, the code I need to get running simply does not work once I begin including MKL in the offload sections. I am willing to be as co-operative as is possible to help troubleshoot this. I would be happy to email someone my code (and a sample of the data that it needs to run on) so they can verify what's going on. Please help!

2 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

Hi Vishal,

Please send your code (and data) so that we can reproduce your problem. I will ask an MKL expert to help you. Thank you.

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!