问题描述
我在Visual Studio 2010中运行的CUDA(V4.2)计划,而我通过各种命令行参数。我想主机编译器看到同样的参数时,我通过nsight(V2.2)运行。我想我已经通过(右键单击项目)要做到这一点 - > nsight用户设置 - >命令行参数,但还没有设法找到一个不崩溃NVCC语法。我假设它是围绕着--run-ARGS不知何故?
I have a cuda (v4.2) program running under visual studio 2010, to which I pass various command line parameters. I want the host compiler to see the same parameters when I run through nsight (v2.2). I assume I have to do this via (right click project) -> nsight user settings->command line arguments, but haven't yet managed to find a syntax that doesn't crash nvcc. I'm assuming it's arranged around "--run-args " somehow?
**澄清,下面的评论后:
** Clarification, after comment below:
当然,你通过属性页/命令参数输入你的命令参数,这一切工作正常。但通过NSight,也被忽略,所以我的问题是,如何做到这一点?我的编译器的通话假定nsight跑到NVCC,然后调用覆盖非CUDA code下MSVC。所以,我认为NSight需要通过任何命令行参数成通过上述选项psumably VS,$ P $。假设所有是合理的,我怀疑我只是得到语法错误里面的nsight用户设置 - >命令行参数,并想知道是否有人在这里成功。更清晰?
Sure when you debug straight through VS, you enter your command arguments through the property pages/command arguments, and that all works fine. But through NSight, that gets ignored, so my question is, how to do it? My talk of compilers assumes that nsight runs up NVCC, which then invokes MSVC under the covers for non CUDA code. So I assume that NSight needs to pass any command line parameters down into VS, presumably via the options described above. Assuming all that is reasonable, I suspect I'm simply getting the syntax wrong inside "nsight user settings->command line arguments" and was wondering if anyone else has succeeded here. Clearer?
推荐答案
如果你正在试图通过NVCC通过命令行参数来CL.EXE或通过命令行参数,以您的应用程序时,它是通过Visual Studio推出的目前还不清楚用命令Nsight CUDA调试器(Nsight |开始CUDA调试)
It is unclear if you are trying to pass command line arguments through nvcc to cl.exe or pass command line arguments to your application when it is launched through Visual Studio with the command Nsight CUDA Debugger (Nsight|Start CUDA Debugging).
- 在Solution Explorer中右键单击该文件.CU
- 执行属性命令
- 在filename.cu属性页
一个。在左窗格中选择CUDA C / C ++\\主机
湾添加参数传递中的其他编译器选项或preprocessor定义 来CL.EXE
- In Solution Explorer Right click on the .cu file
- Execute Properties command
- In the "filename.cu" Property Pagesa. In the left pane Select "CUDA C/C++"\"Host"b. Add parameters to pass to cl.exe in "Additional Compiler Options" or "Preprocessor Definitions"
preprocessor定义将去既nvcc.exe和cl.exe时。
其它编译器选项将被追加到-Xcompiler选项。
Preprocessor definitions will go to both nvcc.exe and cl.exe.Additional Compiler Options will be appended to -Xcompiler options.
- 在Solution Explorer中右键单击该项目(请确保这是你的启动项目)
- 执行Nsight用户属性命令
- 在NVIDIA NSight用户设置对话框
一个。在左窗格中选择启动
湾在右领域的命令行参数中指定的参数。
当您启动与(Nsight |开始CUDA调试)应用这些选项将被传递给应用程序
These options will be passed to the application when you launch the application with (Nsight|Start CUDA Debugging).
- 在Solution Explorer中右键单击该项目(请确保这是你的启动项目)
- 执行属性命令
- 在属性页对话框
一个。在左窗格中选择调试
湾在右窗格中添加参数字段命令参数
在编辑项目属性,Nsight用户属性确保在对话框顶部的指定配置和平台。
When editing project Properties and Nsight User Properties make sure to specify the Configuration and Platform at the top of the dialog.
Nsight VSE构建系统不使用NVCC --run和--run-ARGS选项。如果启动使用调试命令你的进程将被devenv.exe的推出。如果启动使用Nsight |。开始调试CUDA或Nsight分析工具应用程序将被启动Nsight.Monitor.exe
Nsight VSE build system does not use the nvcc --run and --run-args options. If you launch using a Debug command your process will be launched by devenv.exe. If you launch using Nsight|Start CUDA Debugging or Nsight Analysis Tools your application will be launched by Nsight.Monitor.exe.
这篇关于CUDA:传递参数Nsight会议期间举办的编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!