i would like to copy data stored in STL vector to Intel Xeon Phi coprocessor. In my code, I created class which contains vector with data needed to computation. I want to create class object on host, initialize data on host too and then I want to send this object to coprocessor. This is simple code which illustrate what i want to do. After copy object to the coprocessor vector is empty. What can be problem? How do it correctly?
#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.size());
printf("END OFFLOAD");
}
return 0;
}