thrust :: device_vector错误 [英] thrust::device_vector error

查看:499
本文介绍了thrust :: device_vector错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Thrust的新人。我试图从 thrust :: host_vector 复制到 thrust :: device_vector ,两种类型 Sequence 这是我已经实现的类。

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.

但我收到一条错误设备功能无效。
我在GeForce GT 540上使用CUDA 4.0 VS2010。

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; 
    } 
} 

任何人都可以帮忙吗?

推荐答案

该错误消息通常意味着运行时找不到匹配您的GPU体系结构的二进制,即您的编译中没有包括正确的GPU SM版本。因为你使用VS2010的GPU架构通常是通过构建自定义设置。在CUDA C / C ++,设备下的项目属性中,您应该看到代码生成选项。我不确定你的GPU是什么时代,但你可以尝试compute_20,sm_20; compute_20,sm_21来构建两个费米架构。

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.

这篇关于thrust :: device_vector错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆