I want to execute std::sort() in offload method on MIC, the code as following:
#include <stdlib.h> #include <algorithm> #define data_num 100000 #pragma offload_attribute(push,target(mic)) struct T{ float fea; int pos; } ; bool myGreater(T i, T j){ return i.fea > j.fea; } T *data; #pragma offload_attribute(pop) void main(){ #pragma offload target(mic:0) in(data:length(data_num) alloc_if(1)) { data = (T*) malloc(sizeof(T) * data_num); .... std::sort(data, data+data_num, myGreater); } }
I use icc compiler to compile, and it give the error informantion: "undefined reference to std::sort<T*, bool(*)>..." , but when I remove the all "#pragma...", it can go through compile.
I guess that the std::sort algorithm cannot be used in MIC,