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

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

问题描述

在持续收到 error : identifier "atomicAdd" is undefined 之后,我找到了使用 -arch sm_20 标志编译的解决方案.但是如何在 VS 2010 中传递这个编译器标志呢?我在 Project > 下尝试过这样的尝试属性:

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?

非常感谢.

推荐答案

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

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

在这种情况下,compute_20"表示我正在为虚拟计算架构 2.0 进行编译 - 虚拟架构影响 PTX 生成阶段.

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

昏迷之后的第二部分是sm_21".这会影响CUBIN生成阶段.它定义了我想要将 PTX 编译到的真实 GPU 架构.

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.

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

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

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

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