首页 > 解决方案 > 在 platformio-ide-terminal 中构建 CUDA

问题描述

我希望能够使用 Windows 10 Powershell编译和构建此处提供的 CUDA C 源代码。使用x64 Native Tools Command Prompt for VS 2017执行此操作没有问题。

但是,我尝试了几种在线建议的方法来让 Powershell 工作,但没有成功。原因是我希望能够在编辑器 Atom 中构建我的 cuda 代码,使用它platformio-ide-terminal在 Atom 中加载 Powershell 的包。因此,如果我知道如何在 Powershell 中设置 Visual Studio 2017 社区,我会在 Atom 中编辑我的代码并使用其 Powershell 集成方便地构建它们。

我尝试如下设置环境,但仍然nvcc找不到cl.exe.

有人可以帮助我吗?

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\AFP\Downloads\cuda_by_example> cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\"

PS C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build> .\vcvarsall.bat amd64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.7.3
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

PS C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build> cd C:\Users\AFP\Downloads\cuda_by_example\

PS C:\Users\AFP\Downloads\cuda_by_example> nvcc .\chapter03\hello_world.cu
nvcc fatal   : Cannot find compiler 'cl.exe' in PATH

PS C:\Users\AFP\Downloads\cuda_by_example>

标签: visual-studiopowershellcudanvcccl

解决方案


您可以将 cl.exe 的路径添加到环境变量中:

control panel > view advanced system settings > Environment variables > Path > New.

然后添加C:\Program Files (x86)\Microsoft Visual Studio\<year >\Community\VC\Tools\MSVC\<toolset>\bin\Hostx64\x64.

或使用此命令进行编译:nvcc x.cu .\chapter03\hello_world.cu -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\<year >\Community\VC\Tools\MSVC\<toolset>\bin\Hostx64\x64"


推荐阅读