I have to load the data from a file. Each sample is 20-dimensional.
So I used this data structure to help me with this:
class DataType
{
vector<float> d;
}
But while I use this variable definition, it can not work.
thrust::host_vector<DataType> host_input;
// after initializing the host input;
thrust::device_vector<DataType> device_input = host_input;
for(unsigned int i = 0; i < device_input.size(); i++)
for(unsigned int j = 0; j < dim; j++)
cout<<device_input[i].d[j]<<end;
It does not work. The compiler told me that I can not use the vector(host) into the device_input. Because device_input will be implemented on the device(gpu), while vector will be implemented on the CPU. Then, what is the suitable way for me to give an correct definition of DataType?
std::vector
requires host side dynamic mem allocation, so it can not be used in device side.
This should work.
class DataType
{
float d[20];
}