Software Archive
Read-only legacy content
17060 Discussions

strange error when trying to use explicit memory copy

Anwar_Ludin
Beginner
545 Views

Hi,

I've written a very simple shared library containing the following function (the library is supposed to be called from a scripting language):

void sayHelloOpenMPMic(){
   printf("launching threads...\n");
   int i = 0;
   #pragma offload target(mic) inout(i)
   {
     i = omp_get_num_threads();
   }
   printf("available threads: %i", i);
}

The shared library compiles just fine but when I try to execute the function I get the following cryptic message:

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

0 Kudos
8 Replies
Anwar_Ludin
Beginner
545 Views

Here is the compile sequence:

icpc -I/usr/include/R -DNDEBUG -openmp -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -openmp -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c RcppExports.cpp -o RcppExports.o

icpc -I/usr/include/R -DNDEBUG -openmp -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -openmp -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c rcpp_hello_world.cpp -o rcpp_hello_world.o
icpc -shared -L/usr/local/lib64 -o rfastrandom.so RcppExports.o rcpp_hello_world.o -L/usr/lib64/R/library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/lib64/R/library/Rcpp/lib -openmp -L/usr/lib64/R/lib -lR
installing to /home/aludin/R/x86_64-redhat-linux-gnu-library/3.0/rfastrandom/libs

0 Kudos
Bachar_Z_
Beginner
545 Views

I think you should have MIC_LD_LIBRARY_PATH referes to a place can be accessed on MIC!

0 Kudos
Anwar_Ludin
Beginner
545 Views

Bachar Z. wrote:

I think you should have MIC_LD_LIBRARY_PATH referes to a place can be accessed on MIC!

Hi, I don't understand what you mean. I tried to append MIC_LD_LIBRARY_PATH to my LD_LIBRARY_PATH but I get the same error. I also repackaged the function in a standalone app and it works. It's only when I load the function from a shared library that it fails.

0 Kudos
Anwar_Ludin
Beginner
545 Views

I don't understand the reference to undefined symbol: __stack_chk_guard in the error message. Any help would be greatly appreciated in order to solve this issue as I m completely stuck

0 Kudos
Bachar_Z_
Beginner
545 Views

Anwar Ludin wrote:

Quote:

Bachar Z.wrote:

I think you should have MIC_LD_LIBRARY_PATH referes to a place can be accessed on MIC!

Hi, I don't understand what you mean. I tried to append MIC_LD_LIBRARY_PATH to my LD_LIBRARY_PATH but I get the same error. I also repackaged the function in a standalone app and it works. It's only when I load the function from a shared library that it fails.

I had this problem when I started using MIC. To go arround that I have one folder mounted within the mic system, 

Lets call this folder "/work", when you ssh to mic you shoud be able to aces this folder, if you put the library you need inside that folder and make MIC_LD_LIBRARY_PATH refer to this folder. This solved my problem.

0 Kudos
Bachar_Z_
Beginner
545 Views

@Anwar Ludin, I am sorry I have justnotice this!, have you tried to compile without  -fstack-protector?

0 Kudos
Anwar_Ludin
Beginner
545 Views

Bachar Z. wrote:

@Anwar Ludin, I am sorry I have justnotice this!, have you tried to compile without  -fstack-protector?

Hi Bachar! Yeah it worked! Thanks a lot! Actually you were also correct about a missing shared library on the Xeon Phi. I guess -fstack-protector compiler option is implemented by a shared object. Removed it and everything works fine! Once again many thanks! 

0 Kudos
Anwar_Ludin
Beginner
545 Views

Bachar Z. wrote:

@Anwar Ludin, I am sorry I have justnotice this!, have you tried to compile without  -fstack-protector?

Hi Bachar! Yes it worked onced I removed the compiler option...thanks a lot!

0 Kudos
Reply