// thrust::device_vector<thrust::device_vector<double> > n(5,thrust::device_vector<double>(5));
thrust::host_vector<thrust::host_vector<double> > h(5,thrust::host_vector<double>(5));
for(int i = 0; i < 5; ++i)
{
for(int j = 0; j < 5;++j)
{
h[i][j] = i + j;
}
}
// thrust::device_vector<thrust::device_vector<double> > n = h;
// std::cout << "device_vector is size = " << n.size() << std::endl;
std::cout << "host_vector is size = " << h.size() << std::endl;
for(int i = 0; i < 5; ++i)
{
for(int j = 0; j < 5;++j)
{
std::cout << h[i][j] << " ";
}
std::cout << std::endl;
}
这是我写的一段代码,host_vector,可以申请二维向量。但是device_vector不可以申请二维数组。注释的是不可以的。而host_vector是完全可以的。
求助如何配置可以是device_vector可以和host_vector一样可以设置为二维数组。