- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Hello,
I am porting a code to Xeon Phi (using manual offload) and I am experimenting some trouble to compile/execute code with STL vectors on MIC. I isolated a small test case which reproduces the problem (see attached files).
Using classical compilation generates the executable but execution fails :
$ icpc -fPIC -fopenmp ../Code/DATA/RegionF.cxx -I ../Code/DATA $ ./a.out On the remote process, dlopen() failed. The error message sent back from the sink is /tmp/coi_procs/1/192143/load_lib/icpcoutAoy76m: undefined symbol: _ZNSt6vectorIiSaIiEEC1IiEET_S3_RKS0_ On the sink, dlopen() returned NULL. The result of dlerror() is "/tmp/coi_procs/1/192143/load_lib/icpcoutAoy76m: undefined symbol: _ZNSt6vectorIiSaIiEEC1IiEET_S3_RKS0_" offload error: cannot load library to the device 0 (error code 20) $ c++filt _ZNSt6vectorIiSaIiEEC1IiEET_S3_RKS0_ std::vector<int, std::allocator<int> >::vector<int>(int, int, std::allocator<int> const&)
There is a missing symbol concerning std::vector on the MIC side.
If I compile using verification option, it gives me details on the error :
$ icpc -fPIC -fopenmp -offload-option,mic,compiler,"-z defs" ../Code/DATA/RegionF.cxx -I ../Code/DATA /tmp/pbs.1698391.tu-adm01/icpckl957f.o: In function `data::Region::isInside(data::Region const&) const': ../Code/DATA/RegionF.cxx:(.text+0xda): undefined reference to `std::allocator<int>::allocator()' ../Code/DATA/RegionF.cxx:(.text+0xed): undefined reference to `std::vector<int, std::allocator<int> >::vector<int>(int, int, std::allocator<int> const&)' ../Code/DATA/RegionF.cxx:(.text+0xf7): undefined reference to `std::allocator<int>::~allocator()' ../Code/DATA/RegionF.cxx:(.text+0x101): undefined reference to `std::vector<int, std::allocator<int> >::~vector()' ../Code/DATA/RegionF.cxx:(.text+0x116): undefined reference to `std::allocator<int>::~allocator()'
May be I missed something, I tryed to include the #include <vector> into the #pragma offload_attribute(push,target(mic))
region but it's giving me another error.
Is someone can help me to make this small code to work ?
Regards,
Link copiado
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Oups adding ALL includes into to #pragma offload_attribute solve the issue.
Regards,
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
I actually found the real problem is ....don't #define<iostream>
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Jun,
Can I take it you mean #include <iostream>?
You don't want to include iostream in a _Cilk_shared offload region, but you do need to include it in the offload. You need to tell the compiler that it needs to include both processor and coprocessor versions of the member functions but the objects themselves can't be in shared memory - or at least I know of know way to do this.
In any event, Hummel's solution is correct.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Hi Frances
Thanks for you explain. One thing I still not able to understand is that if I put #define<some header > in both outside and inside offload attribute target(mic) region. I will get runtime error. In this example if I have already put #define<iostream> in the offload region, and I put #define<iostream> in regionF.h/regionF.cxx(one of them gives me error...) outside offload region, I get runtime error. I tried same thing for Cilk , runtime error happens.
- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora