Compiling for Offload, needed, crash on first Offload

Compiling for Offload, needed, crash on first Offload

Dear Support Team, dear all,

I'm trying to compile and run an application for the Xeon PHI. However when I link my application with a build script it prints the following warning:

ld: warning:, needed by /opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/, not found (try using -rpath or -rpath-link)

I still can run the program but it crashes on first offload with:

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

To me it looks like std::sqrt is missing?

Before compiling I usually use:

source  /opt/intel/composer_xe_2013_sp1.2.144/bin/ intel64
source /opt/intel/vtune_amplifier_xe/

My compile commands look something like this:

icpc -o foo.o -c -fmessage-length=0 -O3 -fstrict-aliasing -fargument-noalias -xHost -openmp -DSTUFF=0 -Ibuild/build_foo -Isrc src/foo.cpp

Any help is highly appreciated!

Thank you

9 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

It sure appears that you have completed the required steps but the compile-time warning and run-time error suggest something may still be amiss with your environment.
The missing library should be present as part of the Composer XE 2013 SP1 Update installed image under:
Double check the environment variable settings for: LD_LIBRARY_PATH, MIC_LD_LIBRARY_PATH, and MIC_LIBRARY_PATH

$ env | grep LIBRARY






Environment variables are ok and include all you posted.

The librarys are also not missing.

Ok. Then it is not clear why the rpath error occurs. There must be something unique about the link.
The undefined symbol may relate to a library not being found or possibly sqrt somehow not seen as decorated with the __attribute__ (( target (mic))).
The small mock-ups that I have created won't exhibit either error. Can you share a reproducer with us?

Edit: Double Post..

I guess I should have mentioned I use OpenMP 4.0...

However I managed to reduce the problem to this:

#include <cmath>
#pragma omp declare target
class Foo{
  void bar ( float one, float &two ) const {
    two = std::sqrt(one);
#pragma omp end declare target
void main(){
#pragma omp target
    Foo f;
    float a, b;, b);

I just realized the posted Code works if i put the include in declare target!

I somehow expected stuff in std:: to be treated differently on the Phi. A warning would have been nice anyway...

Is this the usual way to do this? I haven't seen this anywhere..


Glad to hear you resolved this. I need to check w/Developers about this. I do not see any specific exclusions for std:: in the OpenMP 4.0 spec. It appears in the definition of “mappable type” section 1.2.5, pg. 11, lines 5-21, it is required.
As for a warning, perhaps the compiler is unable to determine its use within the target region and issue something like:
test.cpp(21): error: variable "std::cout" used in "omp target" region must appear in prior "omp declare target" pragma
I will inquire w/Developers about that too.


Thank you for the advice and fast responses!
I applied this to my real problem. The Link Error still occurs, but I can run the program now in offload. I guess it crashes now because of SegFault :-), but I don't think this is a Phi Problem.

Leave a Comment

Please sign in to add a comment. Not a member? Join today