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

Compiling for Offload, libirng.so 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: 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)

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/compilervars.sh intel64
source /opt/intel/vtune_amplifier_xe/amplxe-vars.sh

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 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

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

 

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{
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);
  }
}

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.

登陆并发表评论。