如何在Visual Studio 2010中设置CUDA编译器标志? [英] How to set CUDA compiler flags in Visual Studio 2010?

查看:539
本文介绍了如何在Visual Studio 2010中设置CUDA编译器标志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在持续获得错误:标识符atomicAdd未定义后,我发现解决方案要使用 -arch sm_20 flag。但是如何通过这个编译器标志在VS 2010?我试过像 Project>属性





但是这显然没有效果,错误仍然存​​在 - 我做错了什么?


解决方案

您可以在此对话框中选择GPU代码生成的选项:





在这种情况下,compute_20意味着我正在为虚拟计算架构2.0编译 - 虚拟架构影响PTX生成阶段。



昏迷是sm_21。这影响CUBIN生成阶段。



您可以找到控制代码生成的nvcc命令行参数的详细说明此处。 p>

After persistently getting error : identifier "atomicAdd" is undefined, I've found the solution to be to compile with -arch sm_20 flag. But how to pass this compiler flag in VS 2010? I have tried like so under Project > Properties:

But this apparently has had no effect and the error persists - what am I doing wrong?

Many thanks.

解决方案

You can select the options for the GPU Code Generation in this dialog:

In this case "compute_20" means that i am compiling for the virtual compute architecture 2.0 - virtual architecture influences the PTX generation stage.

The second part that comes after the coma is "sm_21".This influences the CUBIN generation stage. It defines the real GPU architecture i want to compile the PTX to.

You can find detailed description of the nvcc command line parameters that control the code generation here.

这篇关于如何在Visual Studio 2010中设置CUDA编译器标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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