- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I've got a problem with my program. It's simple code which show my problem.
#pragma offload_attribute (push, target(mic)) #include <vector> #include "offload.h" #include <stdio.h> #pragma offload_attribute (pop) class A { public: A() {} std::vector<int> V; }; int main() { A* wsk = new A(); wsk->V.push_back(1); #pragma offload target(mic) in(wsk) { printf("%d", wsk->V[0]); printf("END OFFLOAD"); } return 0; }
I've got a class object with STL vector which is container for data needed to computation. I would like to create object on host, initialize data for computation on host too, then i want to move class object to do computation on Intel Xeon Phi coprocessor. In result i got error:
offload error: process on the device 0 was terminated by signal 11 (SIGSEGV)
Why it doesn't work correctly? How to transfer STL vector to coprocessor?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When the data you want to pass between the host and the coprocessor is not bit-wise copyable, as in this case, you need to use the virtual shared memory offload model. Check out the sample code that comes with the compilers (which installs in /opt/intel/composerxe/Samples/en_US/C++/mic_samples/shrd_sampleCPP by default) and the section on shared memory programming in the C++ User's Guide in the Intel® Software Documentation Library (https://software.intel.com/en-us/node/522494 for the 15.0 version of the compiler.)

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