thrust::device_vector error

天涯浪子 提交于 2019-12-08 02:07:39

问题


I'm new to Thrust. I'm trying to copy from a thrust::host_vector to a thrust::device_vector, both of type Sequence which is a class I already implemented.

I do however get an error "Invalid Device Function". I'm using CUDA 4.0 VS2010 on a GeForce GT 540.

thrust::host_vector <Sequence> Ind_Tabel_V; 
void Ind_Table_Filling() 
{ 
    //some Code 
    Sequence s; 
    // some code 
    Ind_Tabel_V.push_back(s); 
    try 
    { 
        thrust::device_vector<Sequence> d_vec=Ind_Tabel_V; 
    } 
    catch (thrust::system_error &e) 
    { 
        std::cerr << "Error accessing vector element: " << e.what() << std::endl; 
    } 
} 

Can anyone help please?


回答1:


That error message typically means the runtime cannot find a binary matching your GPU architecture, i.e. you have not included the correct GPU SM version in your compilation. Since you're using VS2010 the GPU architecture is usually set via the build customisation. In the project properties under CUDA C/C++, Device you should see the "Code Generation" option. I'm not sure what generation your GPU is but you could try "compute_20,sm_20;compute_20,sm_21" to build for both Fermi architectures.



来源:https://stackoverflow.com/questions/9711495/thrustdevice-vector-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!