Skip to content

document: Instead of adding cl.exe in PATH, use a more convenient way #79

@Puiching-Memory

Description

@Puiching-Memory

https://vscode.js.cn/docs/cpp/config-msvc#_run-vs-code-outside-the-developer-command-prompt

If you have Visual Studio installed, you may notice two new terminals:
Developer PowerShell for VS 2022
Developer Command Prompt for VS 2022

Running cl in it will take effect without manually adding cl.exe to PATH.
The difference between them and normal shells is that automatic configuration of environment variables is performed before startup.

You can find them in the installation path:
"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1"
"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\LaunchDevCmd.bat"

If we want to use cl in any terminal, we can simply run them in advance.

& "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1"
**********************************************************************
** Visual Studio 2022 Developer PowerShell v17.13.2
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************

PS C:\> cl
用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.43.34808 版
版权所有(C) Microsoft Corporation。保留所有权利。

用法: cl [ 选项... ] 文件名... [ /link 链接选项... ]

PS C:\> & C:/python.exe c:/triton_windows.py                       
cuda_utils.c
  正在创建库 C:\Users\11386\AppData\Local\Temp\tmpjjs4bbey\cuda_utils.cp312-win_amd64.lib 和对象 C:\Users\11386\AppData\Local\Temp\tmpjjs4bbey\cuda_utils.cp312-win_amd64.exp
ptxas info    : 0 bytes gmem
ptxas info    : Compiling entry function 'add_kernel' for 'sm_89'
ptxas info    : Function properties for add_kernel
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info    : Used 26 registers, used 0 barriers, 380 bytes cmem[0]
ptxas info    : Compile time = 0.000 ms
__triton_launcher.c
  正在创建库 C:\Users\11386\AppData\Local\Temp\tmp15uy06sv\__triton_launcher.cp312-win_amd64.lib 和对象 C:\Users\11386\AppData\Local\Temp\tmp15uy06sv\__triton_launcher.cp312-win_amd64.exp
tensor([0., 0., 0.], device='cuda:0')
If you see tensor([0., 0., 0.], device='cuda:0'), then it works

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions