window下源碼編譯mmcv-full==1.2.1


window下源碼編譯mmcv-full==1.2.1

軟件准備:
      Git、vs2019_community、Miniconda3-4.6.14、cuda_10.2+cudnn_7.6.5

一、確認NVIDIA GeForce RTX 2080 Ti已安裝
      cmd 命令:nvidia-smi OR nvidia-smi -L
      *************************************
>nvidia-smi -L
      GPU 0: NVIDIA GeForce RTX 2080 Ti (UUID: GPU-6a2b3f72-b96d-f2d4-bb59-87e7e869b070)

二、下載Miniconda3安裝並設置環境變量
1. Miniconda3-4.6.14-Windows-x86_64.exe
      https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
2. 設置環境變量 Set Environment variable:
      F:\Miniconda3\Library\bin
      F:\Miniconda3\Scripts
      F:\Miniconda3

三、打開Anaconda prompt並創建虛擬環境py37,Launch Anaconda prompt:
      conda create -n py37 python=3.7
      conda activate py37
      # conda remove -n py37 --all# remove 虛擬環境py37
      # CUDA 10.2 安裝pytorch和torchvision
      conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.2 -c pytorch

四、查看torch依賴的cuda和cudnn版本,並下載對應版本的cuda和cudnn,並安裝
>python
      import torch
      print(torch.__version__)
      print(torch.version.cuda)
      print(torch.backends.cudnn.version())

五、git clone mmcv==1.2.1
      git clone https://github.com/open-mmlab/mmcv.git
      cd mmcv
      git checkout 91a7fee
      pip3 install -r requirements.txt

六、設置編譯器 Set up MSVC compiler: Set Environment variable, add
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\Hostx86\x64
      to PATH, so that cl.exe will be available in prompt

      full version with CUDA: Make sure CUDA_PATH or CUDA_HOME is already set, as
      CUDA_PATH C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2
      CUDA_PATH_V10_2 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2

七、設置CUDA的算力Set CUDA target arch
      # Suppose you are using RTX 2080 Ti , which is of capability 7.5
      TORCH_CUDA_ARCH_LIST=7.5

八、可選,設置CPU運行配置# Optional
      MMCV_WITH_OPS=1
      MAX_JOBS=16# based on available number of CPU cores and amount of memory

九、build、install、check mmcv
      cd mmcv
      # build
      python setup.py build_ext # if success, cl will be launched to compile ops
      # install
      python setup.py develop
      # check
      pip list

其他:查看物理CPU數、CPU核心數、線程數
      在cmd命令中輸入“wmic”,然后在出現的新窗口中輸入“cpu get *”

      NumberOfCores:表示CPU核心數
      NumberOfLogicalProcessors:表示CPU線程數

      cmd->wmic
      cmd->CPU GET NumberOfCores,NumberOfLogicalProcessors

      NumberOfCores NumberOfLogicalProcessors
      16 32
      16 32


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM