使用 Visual Studio 2010 编译 CUDA

发布于 2024-09-28 09:11:16 字数 949 浏览 0 评论 0原文

我之前曾使用 Visual Studio 2008 来编译和运行 CUDA 应用程序。我已切换到 Visual Studio 2010 和 Windows 7。我整个上午都在尝试设置集成,但尚未完全成功。我已经下载了工具包,安装了 Nsight,确保设置了库/include/bin 路径,选中了使用 CUDA 3.2 的构建自定义的框,并将单个 .cu 文件的属性设置为 CUDA C 类型/C++ 而不是 C/C++。我收到有关不支持编译器 v100 的错误,因此我将项目平台设置为 v90,现在正在下载 Visual Studio 2008。我希望我不必安装两个版本的 Visual Studio,但是哦,好吧。不管怎样,大多数语法高亮都是启用的,一些关键字如“int”是蓝色的,注释是绿色的,字符串是红色的。然而,像 __ global__ 这样的 cuda 特定关键字却不是。另外,我检查了包含目录,但找不到 cutil.h,所以我想知道 3.2 SDK 的安装中是否还包含其他内容(我已经包含了 cuda_runtime.h,但是我不知道这是否能解决我的问题)。有谁知道如何解决这个问题?

编辑:我安装了 Visual Studio 2008。当我尝试编译时,我收到一个巨大的错误列表,从 1>C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\crtdefs.h(490): error : invalid redeclaration of type name 开始“size_t”,而以下大多数错误都必须处理 size_t 类型。所有错误都在包含的文件中,其中大部分我从未见过。有谁知道发生了什么事吗?或者是否有一个简单的分步指南来让 VS2010 使用 cuda?

编辑 2:显然,我将众多当前设置之一设置为 64 位,将其他设置设置为 32 位。将活动配置、Cuda C/C++ 目标机平台和链接器|高级目标机全部更改为 32 位或 64 位,以便我可以编译和运行。我仍然不知道如何修复 __ global__ 和此类语法突出显示,但这并不是什么大问题。

I have used Visual Studio 2008 to compile and run CUDA applications before. I have switched to Visual Studio 2010 and Windows 7. I've been trying to get integration set up all morning, but haven't had complete success. I've downloaded the toolkit, installed Nsight, made sure the libraries/include/bin paths are set, checked the box to use a Build Customization of CUDA 3.2, and set the properties of the individual .cu file to be of type CUDA C/C++ instead of C/C++. I got an error about not supporting compiler v100, so I set the project platform to v90 and am downloading Visual Studio 2008 now. I was hoping that I wouldn't have to have two versions of visual studio installed, but oh well. Anyway, most of the syntax highlighting is enabled, some keywords like "int" is blue, comments are green, and strings are red. However, cuda-specific keywords like __ global__ aren't. Also, I've checked through the include directories and can't find cutil.h, so I'm wondering if there's anything else that wasn't included in the install of the 3.2 SDK (I have included cuda_runtime.h instead, but I don't know if this will solve my problems). Does anyone know how to fix this?

Edit: I have Visual Studio 2008 installed. When I try to compile, I get a giant list of errors, starting with 1>C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\crtdefs.h(490): error : invalid redeclaration of type name "size_t", while most of the following errors have to deal with the size_t type. All of the errors are in included files, most of which I've never seen. Does anyone know what's going on? Or if there's a simple, step-by-step guide to getting VS2010 to use cuda?

Edit 2: Apparently I had one of the many current settings as 64-bit, and the others as 32-bit. Changing the active configuration, Cuda C/C++ Target Machine Platform, and Linker|Advanced Target Machine all to 32-bit or 64-bit allowed me to compile and run. I still don't have any idea how to fix the __ global__ and such syntax highlighting, but it's not that big of an issue.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冷︶言冷语的世界 2024-10-05 09:11:16

您可以在这里找到完整的指南:

如何在 Visual Studio 2010 中运行 CUDA

You'll find a complete guide here:

How to Run CUDA In Visual Studio 2010

南城旧梦 2024-10-05 09:11:16

您可以检查包含内核的源文件是否是 CUDA/C 文件而不是 C/C++ 文件。 (解决方案资源管理器 -> 文件属性)

you can check if the source file that contains kernel is a CUDA/C file rather than a C/C++ file. (Solution Explorer -> File Properties)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文