之前记录过mmcv-full 1.2.7 在Win 10 下的安装记录,当时的环境版本太低,现在需要升级,重新安装了mmcv-full 1.3.6,本文记录安装过程。
按照记录的环境逐步搭建,这是我安装mmcv时的环境,可以根据个人情况酌情调整,注意各个环境之间的版本依赖
其他版本也可以,建议 3.7 以上 python
可以参考之前的链接
| Toolkit Driver Version | | Minimum Required Driver Version* | |
---|---|---|---|---|
CUDA Toolkit | Linux x86_64 Driver Version | Windows x86_64 Driver Version | Linux x86_64 Driver Version | Windows x86_64 Driver Version |
CUDA 11.3.0 GA |
|
|
|
|
CUDA 11.2.2 Update 2 |
|
|
|
|
CUDA 11.2.1 Update 1 |
|
|
|
|
CUDA 11.2.0 GA |
|
|
|
|
CUDA 11.1.1 Update 1 |
|
|
|
|
CUDA 11.1 GA |
|
|
|
|
CUDA 11.0.3 Update 1 |
|
|
|
|
CUDA 11.0.2 GA |
|
|
|
|
CUDA 11.0.1 RC |
|
|
|
|
CUDA 10.2.89 |
|
|
|
|
CUDA 10.1 (10.1.105 general release, and updates) |
|
|
|
|
CUDA 10.0.130 |
|
|
|
|
CUDA 9.2 (9.2.148 Update 1) |
|
|
|
|
CUDA 9.2 (9.2.88) |
|
|
|
|
CUDA 9.1 (9.1.85) |
|
|
|
|
CUDA 9.0 (9.0.76) |
|
|
|
|
CUDA 8.0 (8.0.61 GA2) |
|
|
|
|
CUDA 8.0 (8.0.44) |
|
|
|
|
CUDA 7.5 (7.5.16) |
|
|
|
|
CUDA 7.0 (7.0.28) |
|
|
|
|
C:\Users\Administrator>nvidia-smi
Wed Jun 16 09:46:55 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 461.92 Driver Version: 461.92 CUDA Version: 11.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 GeForce GTX 1660 WDDM | 00000000:01:00.0 On | N/A |
| 27% 38C P8 4W / 120W | 288MiB / 6144MiB | 12% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1236 C+G Insufficient Permissions N/A |
+-----------------------------------------------------------------------------+
当前 (2021.06.16)最新 cuda 版本 11.3,pytorch 和 mmcv 还不支持,因此建议当前最高cuda版本11.1
https://developer.nvidia.com/cuda-downloads
Visual Studio Intgration
Nsight Visual Studio Edition 安装失败
的错误- [解决方案](https://www.zywvvd.com/notes/environment/cuda/cuda-install-error/cuda-install-error/)
C:\Users\Administrator>nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Tue_Sep_15_19:12:04_Pacific_Daylight_Time_2020
Cuda compilation tools, release 11.1, V11.1.74
Build cuda_11.1.relgpu_drvr455TC455_06.29069683_0
CUDA | torch 1.8 | torch 1.7 | torch 1.6 | torch 1.5 | torch 1.4 | torch 1.3 |
---|---|---|---|---|---|---|
11.1 | install | | | | | |
11.0 | | install | | | | |
10.2 | install | install | install | install | | |
10.1 | install | install | install | install | install | install |
9.2 | | install | install | install | install | install |
cpu | install | install | install | install | install | install |
- conda
conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge
- pip
pip3 install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio===0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
https://download.pytorch.org/whl/torch_stable.html
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\Hostx86\x64
添加到环境变量 PATH, 这样 cl.exe 可以在控制台中所有路径中被调用。C:\Users\Administrator>cl
用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.29.30037 版
版权所有(C) Microsoft Corporation。保留所有权利。
用法: cl [ 选项... ] 文件名... [ /link 链接选项... ]
网上有说仅安装VS C++ build tools 也可以,我尝试的时候没有成功
可以重新构建 anaconda 环境
git clone https://github.com/open-mmlab/mmcv.git
cd mmcv
git checkout v1.3.6
pip3 install -r requirements.txt
变量名称 | 值(需要根据个人情况调整) |
---|---|
CUDA_HOME | C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1 |
CUDA_PATH | C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1 |
MMCV_WITH_OPS | 1 |
MAX_JOBS | 4 |
path | 记得添加 cl.exe 所在文件夹 |
TORCH_CUDA_ARCH_LIST | 7.5 |
TORCH_CUDA_ARCH_LIST
一项表示的是显卡算力,可以在官网查询,我的查不到,可以用CUDA工具查询:执行:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\extras\demo_suite\deviceQuery.exe
C:\>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\extras\demo_suite\deviceQuery.exe"
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\extras\demo_suite\deviceQuery.exe Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce GTX 1660"
CUDA Driver Version / Runtime Version 11.2 / 11.1
CUDA Capability Major/Minor version number: 7.5
Total amount of global memory: 6144 MBytes (6442450944 bytes)
(22) Multiprocessors, ( 64) CUDA Cores/MP: 1408 CUDA Cores
GPU Max Clock rate: 1815 MHz (1.81 GHz)
Memory Clock rate: 4001 Mhz
Memory Bus Width: 192-bit
L2 Cache Size: 1572864 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
Maximum Layered 1D Texture Size, (num) layers 1D=(32768), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(32768, 32768), 2048 layers
Total amount of constant memory: zu bytes
Total amount of shared memory per block: zu bytes
Total number of registers available per block: 65536
Warp size: 32
Maximum number of threads per multiprocessor: 1024
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
Maximum memory pitch: zu bytes
Texture alignment: zu bytes
Concurrent copy and kernel execution: Yes with 6 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
CUDA Device Driver Mode (TCC or WDDM): WDDM (Windows Display Driver Model)
Device supports Unified Addressing (UVA): Yes
Device supports Compute Preemption: Yes
Supports Cooperative Kernel Launch: Yes
Supports MultiDevice Co-op Kernel Launch: No
Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 11.2, CUDA Runtime Version = 11.1, NumDevs = 1, Device0 = GeForce GTX 1660
Result = PASS
CUDA Capability Major/Minor version number: 7.5
里的值填进TORCH_CUDA_ARCH_LIST
中# build
python setup.py build_ext # if success, cl will be launched to compile ops
# install
python setup.py develop
C:\>pip show mmcv-full
Name: mmcv-full
Version: 1.3.6
Summary: OpenMMLab Computer Vision Foundation
Home-page: https://github.com/open-mmlab/mmcv
Author: MMCV Authors
Author-email: openmmlab@gmail.com
License: UNKNOWN
Location: f:\mmcv
Requires: addict, numpy, Pillow, pyyaml, yapf, regex
Required-by:
_ext.cp38-win_amd64.pyd
文件是否生成正常情况下整个过程纵享丝滑,不需要改任何源码
error: Microsoft Visual C++ 14.0 is required
尝试各种办法,装了啥都不行_ext.cp38-win_amd64.pyd
文件,可以安装mmcv-full之后直接放在安装目录中,不需要编译直接可用前提是CUDA、python、torch等版本需要和我一致才能用