Software Archive
Read-only legacy content

offload error: dlopen() failed

wang_p_1
Beginner
545 Views

Hello,

When I try to run my offload code application, I got this error:

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

My compiler version is :

Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.2.144 Build 20140120

Actually, I have try to add compiler option like: -offload-option,mic,compiler,"-z defs"

But I failed. More error information occupied my screen:

offloadConst:(.rodata+0x0): multiple definition of `_IO_stdin_used'
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crt1.o:(.rodata.cst4+0x0): first defined here
offloadConst: In function `main':
(.text+0x160): multiple definition of `main'
/tmp/icpc4lThgP.o:offloadConst.cpp:(.text+0x0): first defined here
offloadConst:(.rodata+0x8): multiple definition of `__dso_handle'
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/crtbegin.o:(.rodata+0x0): first defined here
offloadConst:(.bss+0x120): multiple definition of `array'

....

When I remove the offload code, my application runs well. 

Could you please help me how to resolve this problem

Thank you!

 

 

0 Kudos
4 Replies
Kevin_D_Intel
Employee
545 Views

The message typically relates to a symbol lacking the needed offload declaration.

First try correcting the syntax you noted using for the "-z defs" option. What you posted likely did not have the intended affect. If you are performing a single combined compile and link, then use the first form below. The second form is used only when performing a link.

When passing it through the compiler, the form is:   -offload-option,mic,compiler,"-Wl,-zdefs"

When passing directly to the linker only, the form is:   -offload-option,mic,ld,"-z defs"

If you are still unable to resolve this issue after correcting the "-z defs" syntax then please upload a reproducer that we can work with. The compiler you noted is older and there is also always a possibility of an underlying compiler issue causing this too. We could easily check that with the reproducer too.

Also, what version of MPSS are you using?

0 Kudos
wang_p_1
Beginner
545 Views

Kevin,

Thanks for your quick response.

I have try to use the new compiler option like this:

icpc -o build/debug/volume/volcache.os -c -offload-option,mic,compiler,"-Wl,-zdefs" -O0 -Wall -g -pipe -ipo -no-prec-div -xSSE3 -fp-model fast=2 -openmp -mfpmath=sse -march=nocona -fno-math-errno -fomit-frame-pointer -DMTS_DEBUG -DSINGLE_PRECISION -DSPECTRUM_SAMPLES=3 -DMTS_SSE -DMTS_HAS_COHERENT_RT -fopenmp -fvisibility=hidden -std=c++0x -wd2928 -Qoption,cpp,--rvalue_ctor_is_not_copy_ctor -fPIC -DMTS_HAS_LIBPNG=1 -DMTS_HAS_LIBJPEG=1 -DMTS_HAS_OPENEXR=1 -DMTS_HAS_FFTW=1 -I/usr/include/eigen3 -I/usr/include/OpenEXR -I/usr/local/include -Iinclude src/volume/volcache.cpp

My MPSS version is:

MicInfo Utility Log

Created Thu Jan 28 20:31:59 2016

VERSION: 2.1.6720

Copyright 2011-2013 Intel Corporation All Rights Reserved.

I'm trying to add offload code into Mitsuba which is an open source renderer.

There was only one .cpp file added with offload code, and it is very simple:

//...many head files, like boost

#include <head.h>

#pragma offload_attribute(push,target(mic))

const Surfel* micSurfelsPtr = 0;

float* micColorPtr = 0;

#pragma offload_attribute(pop)

 

void myFunction{

micSurfelsPtr = ....;

micColorPtr = ...;

#pragma offload_transfer target(mic:0) in(micSurfelsPtr:length(size) alloc_if(1) free_if(0)

...// do something

#pragma offload target(mic:0) out(micColorPtr:length(size) alloc_if(1) free_if(1)

{

// do something

}

}

Before this error, I have resolved another problem by myself:

 catastrophic error: *MIC* cannot open source file "boost/version.hpp" 

by adding the boost head files path like:

-I /myBoostIncludePath

My application could find the boost head files by itself but added offload code it could not.

Thanks you again.

Best wishes.

 

0 Kudos
Kevin_D_Intel
Employee
545 Views

MPSS 2.1 is really old. I recommend you consider upgrading both your MPSS and Parallel Studio versions. I think you would be well served by that.

I see –c in your compile line which only compiles to object so the offload-option being added will not have an effect. The –z defs is a linker option that needs to be passed to the linker. If your build procedure compiles many files to object and then combines them with a single linker step, then you need to add the –offload-option to that link step. In that case, you need to use icpc to drive the link and add the second form of the option I mentioned in my earlier post.

I am not proficient in using Boost with offload code. To use Boost functionality/features within the offloaded code you must ensure the Boost headers are available for the offload compilation by encapsulating them in the appropriate #pragma offload_attribute(push/pop) and that associated run-time libraries are built for Xeon Phi and available at link time.

I do not know anything beyond what is mentioned in this post about a pre-built Boost available with MPSS, but my guess is it probably applies to newer MPSS releases than 2.1.

The article, Building the Boost library to run natively on Intel(R) Xeon Phi(tm) Coprocessor, might be of interest/value too.

0 Kudos
wang_p_1
Beginner
545 Views

Hi Kevin,

Thanks for your advice. I'll update my MPSS version and try again.

 

0 Kudos
Reply