English 中文(简体)
CUDA汇编Windows上的问题 地震错误: 没有发现CUDA工具。
原标题:CUDA compile problems on Windows, Cmake error: No CUDA toolset found

so I ve been successfully working on my CUDA program on my Linux but I would like to support Windows platform as well. However, I ve been struggling with correctly compiling it. I use :

  • Windows 10
  • Cmake 3.15
  • Visual Studio 2017
  • CUDA Toolkit 10.1

在使用旧的Cmake CUDA支持使用find_ Package(CUDA 10.1 REQUIRED)cuda_add_libraryetc 则不再适当连接。 因此,我根据

cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(myproject LANGUAGES CXX CUDA)

add_library(mylib SHARED mycudalib.cu)

# My code requires C++ 11 for the CUDA library, not sure which ones of these 
# will do the trick correctly. Never got the compiler this far.
target_compile_features(mylib PUBLIC cxx_std_11)
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CUDA_STANDARD 11)    


set_target_properties( mylib PROPERTIES CUDA_SEPARABLE_COMPILATION ON)

add_executable(test_mylib test.cpp)

target_link_libraries(test_mylib mylib ${CUDA_CUFFT_LIBRARIES})

然而,我从第2行中得出以下错误:

CMake Error at C:/Program Files/CMake/share/cmake-3.15/Modules/CMakeDetermineCompilerId.cmake:345 (message):
  No CUDA toolset found.
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.15/Modules/CMakeDetermineCompilerId.cmake:32 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  C:/Program Files/CMake/share/cmake-3.15/Modules/CMakeDetermineCUDACompiler.cmake:72 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)

我在网上尝试了各种建议,如在CMakeLists.txt增加以下内容:

set(CMAKE_CUDA_COMPILER "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin/nvcc")

or adding the following variable to Cmake: enter image description here

这是CMakeLists.txt案卷一在Libert上用,可以精选地汇编。 差异在于我使用Cmake 3.5和CUDA工具9.0:

cmake_minimum_required(VERSION 3.5)
project( myproject)
find_package(CUDA 9.0 REQUIRED)
if(CUDA_FOUND)  
        list(APPEND CUDA_NVCC_FLAGS "-std=c++11")
endif(CUDA_FOUND)

cuda_add_library(mylib SHARED mycudalib.cu)
cuda_add_executable(test_mylib test.cpp)
target_link_libraries(test_mylib mylib ${CUDA_CUFFT_LIBRARIES})
最佳回答

我现在以不同的《刑法》对其进行审判,并处以罚款。 因此,我完全不知道为什么它不这样做。 由于在我的系统变数中正确确定了CUDA_PATH。

然后,通过安装视力演播室建设工具,并且只有安装了社区观测所,CMake利用了电算系统而不是建筑工具,然后开始做罚款。

问题回答

Windows 10, VS2019 Community, and CUDA 11.3, The following work for me:

  1. Extract the full installation package with 7-zip or WinZip
  2. Copy the four files from this extracted directory .visual_studio_integrationCUDAVisualStudioIntegrationextrasvisual_studio_integrationMSBuildExtensions into the MSBuild folder of your VS2019 install C:Program Files (x86)Microsoft Visual Studio2019CommunityMSBuildMicrosoftVCv160BuildCustomizations

四个档案是:

  • CUDA 11.3.props
  • CUDA 11.3.targets
  • CUDA 11.3.xml
  • Nvda.Build.CudaTasks.v11.3.dll

我曾尝试安装(和重新安装)有视力演播室整合的CUDA,但CMake是能够找到CUDA安装的灯塔(即使有CUDA_PATH和CMAKE_CUDA_COMPILER定义)。

Look at this. It may solve your issues. https://gitlab.kitware.com/cmake/cmake/issues/19029

Seems like Nvidia cuda installer has some issues with installing the VS integration with vs 2017. Check if you can find this file in your vs installing path.

C:/Program Files (x86)/Microsoft Visual 
Studio/2017/Professional/Common7/IDE/VC/VCTargets/BuildCustomizations/CUDA 
10.1.xml

我试图从源头修建黑暗网,并跨越这一问题。

What resolved it for me was the following:

  • making sure no other Visual Studio or Visual Studio Build Tool was installed except for VS2019. (I configured this using the uninstall feature of the ~1 mb vs_community.exe installer program)
  • REINSTALLING CUDA 10.1, using the 2.5 gb installer, and in that process, making sure VS Integration is installed (for me... this was a reinstall since I had already installed it, but with a bunch of VS2019,VS2017 + Build Tools all installed at once!!) during the installation.

当时,我的黄瓜档案仍存放在10.1个装置的双面/平衡/封面上,我再次打上CMake的“冲突”。

成功! 无错误。 (CMake 3.18, VS2019, CUDA 10.1.243, cudnn 7.6.5)

我只看到了不同版本的《世界人权宣言》工具与我的系统相同的问题:

-Windows 11 -Cmake 3.20.0 -Visual Studio 2019 -CUDA Toolkit 11.6

一些网民说,如果你在安装“CUDA”之前安装了视频演播室,就会出现这种情况。 因此,我尝试并重新加入《世界人权宣言》,最后,它现在工作。 你也可以尝试。 Good luck.

https://i.stack.imgur.com/QPAvi.png” rel=“nofollow noreferer”>。

我有一个类似的问题,而且很可能是@ James声称是正确的,它只是视觉演播室,是混杂的。 我接下来是@bjacobowski。 关于今后的任何参考资料,我综合了CUDA12.1和Series视觉版本2022社区版本。

  • I copied the four files from C:Program FilesNVIDIA GPU Computing ToolkitCUDAv12.1extrasvisual_studio_integrationMSBuildExtensions
  • And pasted into C:Program FilesMicrosoft Visual Studio2022CommunityMSBuildMicrosoftVCv170BuildCustomizations

对任何人来说,我解决这一问题的办法就是在CMake指挥部中增加以下内容:

-DCMAKE_GENERATOR_TOOLSET="cuda=C:Program FilesNVIDIA GPU Computing ToolkitCUDAv12.2"

以及复制4份VS集成文档(C:Program 文件) NVIDIA GPU 计算机工具包

  • C:Program Files (x86)Microsoft Visual Studio2022BuildToolsMSBuildMicrosoftVCv170BuildCustomizations
  • and C:Program FilesMicrosoft Visual Studio2022CommunityMSBuildMicrosoftVCv170BuildCustomizations

在所有这些赛事之后,文化、青年和体育部都很高兴,并开始编纂。 我 t了《世界人权宣言》或任何东西。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?