Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

undefined symbol: __offload_set_version

Iris_L_
Beginner
607 Views

Hi,

I am trying to run a simple offload code and I got this error:

undefined symbol: __offload_set_version

Could you help to identify this error?

  1. source code:
  2. ========
  3. #include "offload.h"
  4. #include <stdio.h>
  5. #include <iostream>
  6. void main()
  7. {
  8.     _Offload_status x;
  9.     OFFLOAD_STATUS_INIT(x);
  10. #pragma offload target(mic) status(x) mandatory
  11.     {
  12.         if (_Offload_get_device_number() < 0) {
  13.             printf("mandatory offload ran on CPU\n");
  14.         } else {
  15.             printf("mandatory offload ran on MIC\n");
  16.         }
  17.     }
  18.     if (x.result == OFFLOAD_SUCCESS) {
  19.         printf("mandatory offload was successful\n");
  20.     } else {
  21.         printf("mandatory offload failed\n");
  22.     }
  23. }

 

0 Kudos
6 Replies
Ravi_N_Intel
Employee
607 Views

__offload_set_version is defined in liboffload_so.5

nm liboffload.so.5 | grep offload_set_version

0000000000003c710 T _offload_set_version.

0 Kudos
Iris_L_
Beginner
607 Views

it seems that liboffload.so.5  is not linked to any program that has #pragma offload.

The lib is in my system but the program does not see that.

I think this error stated when I updated the version of 

Intel® Parallel Studio XE Professional Edition for Fortran and C++ Linux* (all tools) 2016

Version: Update 3

 

 

0 Kudos
Kevin_D_Intel
Employee
607 Views

Check your underlying environment configuration. You can suffer either error below when compiling with 16.0.3 but where the underlying run-time environment aligns to the 15.0 release RTLs, specifically the MIC_LD_LIBRARY_PATH and/or LD_LIBRARY_PATH settings.

Where the MIC_LD_LIBRARY_PATH refers to 15.0 RTLs, you might see:

$ ./a.out
/tmp/coi_procs/1/5460/aMIC.out: symbol lookup error: /tmp/coi_procs/1/5460/aMIC.out: undefined symbol: __offload_set_version
offload error: process on the device 0 unexpectedly exited with code 127

You can also suffer a similar error compiling with 16.0.3 but where your LD_LIBRARY_PATH setting aligns to a previous 15.0 release. e.g.

$ ./a.out
./a.out: symbol lookup error: ./a.out: undefined symbol: __offload_set_version

It is unclear which possible case you might have experienced so check that MIC_LD_LIBRARY_PATH and LD_LIBRARY_PATH reference paths under the 16.0.3 (i.e 2016.3.201) area and not an earlier 15.0 area.

0 Kudos
Iris_L_
Beginner
607 Views

it seems that the paths are ok.

I solved the problem by running this command

source /opt/intel/compilers_and_libraries_2016.3.210/linux/bin/compilervars.sh intel64

so, after the upgrading, the compilervars.sh was not executed anymore, is that possible? Is it suppose to execute automatically? 

 

echo $LD_LIBRARY_PATH 

/opt/intel/compilers_and_libraries_2016.3.210/linux/compiler/lib/intel64:/opt/intel/compilers_and_libraries_2016.3.210/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2016.3.210/linux/mpi/intel64/lib:/opt/intel/compilers_and_libraries_2016.3.210/linux/mpi/mic/lib:/opt/intel/compilers_and_libraries_2016.3.210/linux/ipp/lib/intel64:/opt/intel/mic/coi/host-linux-release/lib:/opt/intel/mic/myo/lib:/opt/intel/compilers_and_libraries_2016.3.210/linux/compiler/lib/intel64:/opt/intel/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64:/opt/intel/compilers_and_libraries_2016.3.210/linux/tbb/lib/intel64/gcc4.4:/opt/intel/debugger_2016/libipt/intel64/lib:/opt/intel/compilers_and_libraries_2016.3.210/linux/daal/lib/intel64_lin:/opt/intel/compilers_and_libraries_2016.3.210/linux/daal/../tbb/lib/intel64_lin/gcc4.4:/opt/intel/compilers_and_libraries_2016.3.210/linux/daal/../compiler/lib/intel64_lin:/opt/intel/clck/3.1.2.006/provider/share/offload_phi/intel64:/opt/intel/clck/3.1.2.006/provider/share/offload_phi/mic:/opt/intel/clck/3.1.2.006/provider/share/offload_phi/intel64/:/opt/intel/clck/3.1.2.006/provider/share/offload_phi/mic/:/opt/intel/compilers_and_libraries_2016.3.210/linux/compiler/lib/intel64_lin/:/opt/intel/compilers_and_libraries_2016.3.210/linux/compiler/lib/intel64_lin_mic/

echo $MIC_LD_LIBRARY_PATH 

/opt/intel/compilers_and_libraries_2016.3.210/linux/mpi/mic/lib:/opt/intel/compilers_and_libraries_2016.3.210/linux/compiler/lib/mic:/opt/intel/compilers_and_libraries_2016.3.210/linux/ipp/lib/mic:/opt/intel/mic/coi/device-linux-release/lib:/opt/intel/mic/myo/lib:/opt/intel/compilers_and_libraries_2016.3.210/linux/compiler/lib/mic:/opt/intel/compilers_and_libraries_2016.3.210/linux/mkl/lib/mic:/opt/intel/compilers_and_libraries_2016.3.210/linux/tbb/lib/mic

 

 

 

 

0 Kudos
Kevin_D_Intel
Employee
607 Views

If you hadn't sourced the 16.0.3 compilervars to begin with then how did you invoke the 16.0.3 compiler?

The compilervars is not run automatically. Some choose to add the source command to their private shell initialization (i.e. .bashrc). Maybe your private shell initialization file is hard coded to source the 15.0 version, so editing it to refer to 16.0.3 would do it automatically.

Glad you resolved the error.

0 Kudos
Iris_L_
Beginner
607 Views

Well, I have no idea how the compiler worked without source compilervars.sh. I also compiled other codes such as gaussianElimination and it compiled and executed as a native code, but when I tried to use #pragma offload inside the code I could not run the program anymore, but the compiler still worked with no errors.

Thanks,

 

 

 

0 Kudos
Reply