- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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,
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Encapsulate at least <algorithm> within an offload_attribute push/pop. i.e.
#pragma offload_attribute(push, target(mic))
#include <algorithm>
#pragma offload_attribute(pop)
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Encapsulate at least <algorithm> within an offload_attribute push/pop. i.e.
#pragma offload_attribute(push, target(mic))
#include <algorithm>
#pragma offload_attribute(pop)

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page