[BUG解决]MMCV CUDA Compiler : not available与RuntimeError: nms is not compiled with GPU support

问题描述:

在GFL复现过程中第一个Epoch结束后发现

RuntimeError: nms is not compiled with GPU support

在日志文件中发现:

TorchVision: 0.8.1+cu110
OpenCV: 4.7.0
MMCV: 1.2.0
MMCV Compiler: GCC 7.3
MMCV CUDA Compiler: not available
MMDetection: 2.6.0+
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

问题分析:

MMCV没有驱动cuda,mmcv没驱动GPU

问题解决:

  1. 确保成功安装了torch的gpu版本
  2. 确保mmcv的版本与自己的torch、cuda版本匹配(可以通过这里查找安装 MMCV — mmcv 1.7.1 文档
  3. MMCV 未与 CUDA 一起安装:MMCV_WITH_OPS=1 FORCE_CUDA=1 pip install mmcv-full

综上:

以我自己的版本举例:

PyTorch: 1.7.0+cu110(编译环境要求mmcv<=1.3.0

MMCV_WITH_OPS=1 FORCE_CUDA=1 pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu10/torch1.8.0/index.html

则可成功解决

可以运行 mmdet/utilscollect_env.py

输出:

TorchVision: 0.8.1+cu110
OpenCV: 4.7.0
MMCV: 1.2.0
MMCV Compiler: GCC 9.4
MMCV CUDA Compiler: 11.4