Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Kai_X_
Beginner
52 Views

Xeon Phi Cilk Offload: problem with libraries

I try to use Cilk_offload on host + Xeon Phi. test.cc:

#pragma offload_attribute (push,target(mic))                                                          
#include <vector>
#include <string> 
#pragma offload_attribute (pop)                                                                       
                     
#include <iostream>                                                                                   
#include <stdio.h>                                                                                    
#include <stdlib.h>                                                                                   
#include <stdint.h>                                                                                   
                                                                                                      
using namespace std;                                                                                  
 
                                                                                                      
int main(const int argc, const char *argv[]) {

 #pragma offload target(mic:0)                                                                        
{ 
        vector<int> tmp;
        tmp.push_back(10);
        printf("%d\n",tmp[0]);                                                                        
                                                                                                  
} 
                                                
  return 0;                                                                                           
 }

 

Building: icc test.cc -o test

When I try to run it, I get the following error:

x86_64-k1om-linux-ld: /usr/linux-k1om-4.7/linux-k1om/usr/lib64/libmyo-service.so: undefined reference to symbol 'pthread_key_delete@@GLIBC_2.2.5'
x86_64-k1om-linux-ld: note: 'pthread_key_delete@@GLIBC_2.2.5' is defined in DSO /usr/linux-k1om-4.7/linux-k1om/lib64/libpthread.so.0 so try adding it to the linker command line
/usr/linux-k1om-4.7/linux-k1om/lib64/libpthread.so.0: could not read symbols: Invalid operation

And if I remove "#include <string>", everything is ok.

I need <vector> and <string> in a complex program where I have the same problem.

What should I do?

 

0 Kudos
2 Replies
Rajiv_D_Intel
Employee
52 Views

Bracket all the includes with

#pragma offload_attribute (push,target(mic))

#pragma offload_attribute (pop)                                                   

h_i_k_
Beginner
52 Views

Hello,

Rajiv's suggestion of bracketing the includes in #pragmas does not work on my Xeon Phi.  Like Kai, I continue to get a linking failure unless I comment out the include of <string>.  Like Kai, I have no problem with header <vector>.

Below is the very simple test program that I use to check if <string> links ok:

#pragma offload_attribute (push, _Cilk_shared)
#include <string>

#include "offload.h"
#pragma offload_attribute (pop)

int main() {
  return 11;
}

The output I get is this:

%> icpc -std=c++11 -DSET_OFFLOAD -parallel -w -qoffload=mandatory hello_world.cc -o hello_world
/tmp/icpcL3gU5O.o:(.MyoFptrTable.[vsnprintf_myo_thunk_fptr_$MyoTable]+0x10): undefined reference to `vsnprintf_wrapper'
/tmp/icpcL3gU5O.o:(.MyoFptrTable.[__gthrw___cb56f3cfa32ea75bbbe3ad8772dda773_myo_thunk_fptr_$MyoTable]+0x10): undefined reference to `__gthrw___cb56f3cfa32ea75bbbe3ad8772dda773_wrapper'
/tmp/icpcL3gU5O.o:(.MyoFptrTable.[vswprintf_myo_thunk_fptr_$MyoTable]+0x10): undefined reference to `vswprintf_wrapper'
make: *** [hello-world] Error 1

If I comment out the include of <string> like this:

#pragma offload_attribute (push, _Cilk_shared)
//#include <string>
#include "offload.h"
#pragma offload_attribute (pop)

int main() {
  return 11;
}

~

The program compiles, links and runs.

Could Intel please help with this.  I requested support 10 days ago and have not gotten a helpful response yet.

Thanks,

H

Reply