visual-studio - 在 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>
解决方案
您可以将 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"
推荐阅读
- .net-core - 在我们的 API 响应中合并两个结果集
- menu - Vaadin TestBench MenuBarElement - 无法使用集成测试选择子菜单
- windows - PgAdmin 4 无法连接到 Windows 10 中 PostgreSQL 数据库中的服务器错误
- python - 如何在我的 django amazon 产品跟踪项目中安排任务?
- css - 右对齐导航栏按钮
- mongodb - 在 MongoDB 中哪里可以找到用户名和密码以完成连接字符串 Mongoose => MongoDB
- python - ValueError:Layer MLP_Model 需要 1 个输入,但它接收到 460 个输入张量。(在密集层)
- r - 错误警告:lm.fit 中的错误(x,y,offset = offset,singular.ok =singular.ok,...):'y' 中的 NA/NaN/Inf
- python - 比较两个 SQL 表并返回有变化的行数
- javascript - 创建一个将 html 文件转换为可读文本文档的 WordPress 插件