
之前记录过mmcv-full 1.2.7 在Win 10 下的安装记录,Windows 10 mmcv-full 1.3.6 安装记录 和 Windows 11 mmcv-full 1.3.9 安装记录,近来mmcv-full 升级到了1.3.13,本文记录安装过程。
按照记录的环境逐步搭建,这是我安装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) |
|
|
|
|
$ nvidia-smi
Sat Sep 25 22:50:39 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 471.41 Driver Version: 471.41 CUDA Version: 11.4 |
|-------------------------------+----------------------+----------------------+
| 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 NVIDIA GeForce ... WDDM | 00000000:02:00.0 Off | N/A |
| N/A 0C P8 N/A / N/A | 40MiB / 4096MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
当前 (2021.09)最新 cuda 版本 11.3,pytorch 和 mmcv 还不支持,因此建议当前最高cuda版本11.1
https://developer.nvidia.com/cuda-downloads
Visual Studio IntgrationNsight 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_0CUDA | torch 1.9 | torch 1.8 | torch 1.7 | torch 1.6 | torch 1.5 | torch 1.4 | torch 1.3 |
|---|---|---|---|---|---|---|---|
11.1 | install | install | | | | | |
11.0 | | | install | | | | |
10.2 | install | 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 | install |
- condaconda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge
- pippip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio===0.9.1 -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.13
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 | 5.0 |
TORCH_CUDA_ARCH_LIST一项表示的是显卡算力,可以在官网查询,我的查不到,可以用CUDA工具查询:执行:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\extras\demo_suite\deviceQuery.exe
>deviceQuery.exe
deviceQuery.exe Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "NVIDIA GeForce GTX 960M"
CUDA Driver Version / Runtime Version 11.4 / 11.1
CUDA Capability Major/Minor version number: 5.0
Total amount of global memory: 4096 MBytes (4294967296 bytes)
( 5) Multiprocessors, (128) CUDA Cores/MP: 640 CUDA Cores
GPU Max Clock rate: 1176 MHz (1.18 GHz)
Memory Clock rate: 2505 Mhz
Memory Bus Width: 128-bit
L2 Cache Size: 2097152 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 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: 2048
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 4 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: No
Supports Cooperative Kernel Launch: No
Supports MultiDevice Co-op Kernel Launch: No
Device PCI Domain ID / Bus ID / location ID: 0 / 2 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 11.4, CUDA Runtime Version = 11.1, NumDevs = 1, Device0 = NVIDIA GeForce GTX 960M
Result = PASS
CUDA Capability Major/Minor version number: 5.0里的值填进TORCH_CUDA_ARCH_LIST中# build
python setup.py build_ext # if success, cl will be launched to compile ops
# install
python setup.py develop
(base) H:\test\mmcv>pip show mmcv-full
Name: mmcv-full
Version: 1.3.13
Summary: OpenMMLab Computer Vision Foundation
Home-page: https://github.com/open-mmlab/mmcv
Author: MMCV Contributors
Author-email: openmmlab@gmail.com
License: UNKNOWN
Location: h:\test\mmcv
Requires: addict, numpy, packaging, Pillow, pyyaml, yapf, regex
Required-by:

_ext.cp38-win_amd64.pyd文件生成
正常情况下整个过程纵享丝滑,不需要改任何源码
_ext.cp38-win_amd64.pyd文件,可以安装mmcv-full之后直接放在安装目录中,不需要编译直接可用当python环境中没有安装pytorch时mmcv不会编译,可以顺利成功安装,这之后再放入pyd文件即可 编译时设置不同的算力值会生成不同算力的pyd文件 文件名:
_ext.cp38-win_amd64.pyd
前提是CUDA、python、torch、显卡算力等版本需要和我一致才能用。