windows 为什么 nvcc 找不到我的 Visual C++ 安装?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2760374/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 14:24:08  来源:igfitidea点击:

Why can't nvcc find my Visual C++ installation?

windowsvisual-c++cudanvcc

提问by Hyman Lloyd

I'm running Windows 7 Pro x64 on a Core i5 with a NVIDIA 3100m, which is CUDA compatible.

我在配备 NVIDIA 3100m(与 CUDA 兼容)的 Core i5 上运行 Windows 7 Pro x64。

I've tried installing both the 32-bit and 64-bit CUDA toolkits from NVIDIA, unfortunately from with either of them I cannot compile anything; nvcc says "cannot find a supported cl version. Only MSVC 8.0 and MSVC 9.0 are supported".

我试过从 NVIDIA 安装 32 位和 64 位 CUDA 工具包,不幸的是,我无法编译任何东西;nvcc 说“找不到支持的 cl 版本。仅支持 MSVC 8.0 和 MSVC 9.0”。

I have the x86 and x86-64 compilers installed via the Windows 7 SDK (compiler version 15.00.30729.01 for both arches). Both compilers are operating correctly; I've built and tested C and C++ code using them. I've tried running nvcc from command shells set up for both 32 bit and 64 bit compilation, and using the -ccbin command line option to nvcc to point it at the Visual C++ install directory.

我通过 Windows 7 SDK(两个拱门的编译器版本 15.00.30729.01)安装了 x86 和 x86-64 编译器。两个编译器都运行正常;我已经使用它们构建并测试了 C 和 C++ 代码。我尝试从为 32 位和 64 位编译设置的命令外壳运行 nvcc,并使用 nvcc 的 -ccbin 命令行选项将其指向 Visual C++ 安装目录。

What is the right way of handling this setup? Is there some way I make nvcc be more verbose about what is going on? The -v flag isn't terrible helpful. Ideally some way to make it show what it is finding versus what it's expecting to find. Will this work better if I install Visual C++ Express instead? Or is only a commercial version of VC++ supported for use with CUDA?

处理此设置的正确方法是什么?有什么方法可以让 nvcc 更详细地说明正在发生的事情吗?-v 标志并不是非常有用。理想情况下,可以通过某种方式使其显示正在查找的内容与期望查找的内容。如果我安装 Visual C++ Express 会更好吗?还是只有商业版本的 VC++ 支持与 CUDA 一起使用?

采纳答案by sjchoi

It looks like you didn't install Visual Studio 2005 or 2008, but your compiler version number indicates it is MSVC 9.0. The simplest way to get everything working is to install Visual Studiso and I believe Express will work.

看起来您没有安装 Visual Studio 2005 或 2008,但您的编译器版本号表明它是 MSVC 9.0。使一切正常运行的最简单方法是安装 Visual Studio,我相信 Express 会起作用。

Also, you might want to take a look at this topic on Nvidia Forum

另外,您可能想在Nvidia 论坛上查看此主题

回答by Indy9000

Include this line

包括这一行

compiler-bindir = C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin

编译器-bindir = C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin

in

C:\CUDA\bin64\nvcc.profile

C:\CUDA\bin64\nvcc.profile

回答by Fiarr

With CUDA v6.0, having an older version of Visual Studio (I'm using 2010) is still required, but the other solutions did not work for me.

使用 CUDA v6.0,仍然需要旧版本的 Visual Studio(我使用的是 2010),但其他解决方案对我不起作用。

To make this work, add the following to your nvcc.profile (C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v6.0/bin/nvcc.profile):

要使此工作正常进行,请将以下内容添加到您的 nvcc.profile (C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v6.0/bin/nvcc.profile):

CUDA_NVCC_FLAGS += --compiler-bindir = "-IE:/PROGRA~2/MICROS~2.0/VC/bin"

I also have VS 2013 installed, and I needed this argument to prevent nvcc from finding the newer (sadly incompatible) version of cl.exe

我还安装了 VS 2013,我需要这个参数来防止 nvcc 找到更新的(可悲的是不兼容)版本的 cl.exe

回答by Vortex

I was trying to get CUDA 6.5 working with VS 2010 express. After uninstalling VS 2010 express, installing Windows SDK 7.1 and reinstalling VS 2010 express, setting Windows SDK 7.1 as tool set, etc. Nothing worked. In the end what worked for me was to add the following to CUDA_NVCC_FLAGS:

我试图让 CUDA 6.5 与 VS 2010 express 一起工作。卸载VS 2010 express,安装Windows SDK 7.1并重新安装VS 2010 express,将Windows SDK 7.1设置为工具集等后,没有任何效果。最后,对我有用的是将以下内容添加到 CUDA_NVCC_FLAGS:

--cl-version 2010

You may also need to add:

您可能还需要添加:

--machine 32

I tried the appropriate flags in the command line first.

我首先在命令行中尝试了适当的标志。

This link was very helpful

这个链接很有帮助