Software Archive
Read-only legacy content
17061 Discussions

Compiling for Offload, libirng.so needed, crash on first Offload

Alex_K_
Beginner
1,148 Views

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:

[bash]ld: warning: libirng.so, needed by /opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/liboffload.so.5, not found (try using -rpath or -rpath-link)[/bash]

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

[bash]

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)

[/bash]

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

Before compiling I usually use:

[bash]source  /opt/intel/composer_xe_2013_sp1.2.144/bin/compilervars.sh intel64

source /opt/intel/vtune_amplifier_xe/amplxe-vars.sh[/bash]

My compile commands look something like this:

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

Any help is highly appreciated!

Thank you

0 Kudos
8 Replies
Kevin_D_Intel
Employee
1,148 Views

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:
/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/mic/libirng.so
/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/libirng.so
Double check the environment variable settings for: LD_LIBRARY_PATH, MIC_LD_LIBRARY_PATH, and MIC_LIBRARY_PATH

$ env | grep LIBRARY

LIBRARY_PATH=/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/ipp/../compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/ipp/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4

MIC_LD_LIBRARY_PATH=/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/mic:/opt/intel/composer_xe_2013_sp1.2.144/mpirt/lib/mic:/opt/intel/mic/coi/device-linux-release/lib:/opt/intel/mic/myo/lib:/opt/intel/mic/coi/device-linux-release/lib:/opt/intel/mic/myo/lib:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/mic:/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/mic:/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/mic

LD_LIBRARY_PATH=/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64:/opt/intel/mic/coi/host-linux-release/lib:/opt/intel/mic/myo/lib:/opt/intel/composer_xe_2013_sp1.2.144/mpirt/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/ipp/../compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/ipp/lib/intel64:/opt/intel/mic/coi/host-linux-release/lib:/opt/intel/mic/myo/lib:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4

MIC_LIBRARY_PATH=/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/mic

 

0 Kudos
Alex_K_
Beginner
1,148 Views

Environment variables are ok and include all you posted.

The librarys are also not missing.

0 Kudos
Kevin_D_Intel
Employee
1,147 Views

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?

0 Kudos
Alex_K_
Beginner
1,148 Views

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

However I managed to reduce the problem to this:

[cpp]

#include <cmath>

#pragma omp declare target

class Foo{

public:

  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;

    f.bar(a, b);

  }

}

[/cpp]

0 Kudos
Alex_K_
Beginner
1,148 Views

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..

 

0 Kudos
Kevin_D_Intel
Employee
1,148 Views

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.

 

0 Kudos
Alex_K_
Beginner
1,148 Views
Edit: Double Post..
0 Kudos
Alex_K_
Beginner
1,148 Views
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.
0 Kudos
Reply