【问题标题】:Error with thrust::device_vector in Cuda using Visual Studio 2012使用 Visual Studio 2012 在 Cuda 中的推力::device_vector 错误
【发布时间】:2016-10-03 15:59:39
【问题描述】:

我正在尝试使用 makefile 在 VS2012 中编译和运行以下简单的 cuda 示例:

#include <thrust/device_vector.h>
#include <thrust/device_ptr.h>

int main()
{
thrust::device_vector<double> my_new_vector(10); // create a vector of size 10
}

我的makefile非常简单,编译成功。运行可执行文件时,它崩溃了!它似乎不喜欢device_vector。我正在使用 Windows 7/CUDA 8.0/VS2012 运行它。我在 CUDA 7.5 上遇到了同样的错误。如果我用简单的std::cout &lt;&lt; "hello world!\n";替换该行,它将完美运行。

device_vector不起作用有什么原因吗?

【问题讨论】:

  • 崩溃前的任何错误信息?你也可以上传makefile吗?
  • 可能是因为您正在构建一个 win32 可执行文件。构建一个 x64 可执行文件。

标签: visual-studio-2012 makefile cuda


【解决方案1】:

我只需要更改--gpu-name 选项。现在可以了!

【讨论】:

    猜你喜欢
    • 2015-05-11
    • 2013-01-04
    • 2011-12-24
    • 2013-06-08
    • 1970-01-01
    • 2011-11-29
    • 2020-10-18
    相关资源
    最近更新 更多