官方smoke 开源项目的环境 requirements
Ubuntu 16.04
Python 3.7
Pytorch 1.3.1
CUDA 10.0
但是我的电脑是RTX3070的显卡,默认支持cuda11.1及以上版本,所以我就各种尝试配置环境如下:
(base) zxl@R9000P:~/mywork/MANA-AI/DCNv2_latest$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Mon_Oct_12_20:09:46_PDT_2020
Cuda compilation tools, release 11.1, V11.1.105
Build cuda_11.1.TC455_06.29190527_0
ubuntu18.04
python 3.8
pytorch1.8.1和1.9.0
CUDA11.1
在pytorch1.8.1和1.9.0环境下执行指令:
python setup.py build develop
后报错如下
/home/zxl/mywork/MANA-AI/smoke_mono_3d/smoke/csrc/cuda/dcn_v2_cuda.cu(127):
error: identifier "THCudaBlas_SgemmBatched" is undefined
/home/zxl/mywork/MANA-AI/smoke_mono_3d/smoke/csrc/cuda/dcn_v2_cuda.cu(275): error: identifier "THCudaBlas_Sgemm" is undefined
/home/zxl/mywork/MANA-AI/smoke_mono_3d/smoke/csrc/cuda/dcn_v2_cuda.cu(329): error: identifier "THCudaBlas_Sgemv" is undefined
3 errors detected in the compilation of "/home/zxl/mywork/MANA-AI/smoke_mono_3d/smoke/csrc/cuda/dcn_v2_cuda.cu".
error: command '/usr/local/cuda-11.1/bin/nvcc' failed with exit status 1
网上各种百度找到了下面的方法
git clone https://github.com/jinfagang/DCNv2_latest.git
cd DCNv2_latest
python setup.py build develop
cuda 11.1 +pytorch1.8.1或1.9.0能build成功,但是执行测试程序
python testcuda.py
报错如下
raise RuntimeError(msg)
RuntimeError: Jacobian mismatch for output 0 with respect to input 0,
numerical:tensor([[ 0.4043, 0.0048, -0.0100, ..., 0.0000, 0.0000, 0.0000],
[ 0.1935, 0.0695, 0.0132, ..., 0.0000, 0.0000, 0.0000],
[-0.0009, 0.0000, 0.3827, ..., 0.0000, 0.0000, 0.0000],
...,
[ 0.0000, 0.0000, 0.0000, ..., 0.0000, -0.0237, 0.0000],
[ 0.0000, 0.0000, 0.0000, ..., -0.4143, -0.8342, 0.0000],
[ 0.0000, 0.0000, 0.0000, ..., -0.2155, -0.1278, -0.1084]],
device='cuda:0')
analytical:tensor([[ 0.4043, 0.0049, -0.0100, ..., 0.0000, 0.0000, 0.0000],
[ 0.1934, 0.0695, 0.0133, ..., 0.0000, 0.0000, 0.0000],
[-0.0011, 0.0000, 0.3829, ..., 0.0000, 0.0000, 0.0000],
...,
[ 0.0000, 0.0000, 0.0000, ..., 0.0000, -0.0237, 0.0000],
[ 0.0000, 0.0000, 0.0000, ..., -0.4146, -0.8340, 0.0000],
[ 0.0000, 0.0000, 0.0000, ..., -0.2157, -0.1280, -0.1084]],
device='cuda:0')
最让我百思不得其解的是,三个环境下运行下面的指令都成功
(py38torch171-smoke) zxl@R9000P:~/mywork/MANA-AI/DCNv2_latest$ python
Python 3.8.10 (default, Jun 4 2021, 15:09:15)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.7.1'
>>> torch.cuda.is_available()
True
>>>
(py38torch181-smoke) zxl@R9000P:~/mywork/MANA-AI/DCNv2_la00m$ python
Python 3.8.10 (default, Jun 4 2021, 15:09:15)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.8.1+cu111'
>>> torch.cuda.is_available()
True
>>>
(py38torch190-smoke) zxl@R9000P:~/mywork/MANA-AI/DCNv2_latest$ python
Python 3.8.10 (default, Jun 4 2021, 15:09:15)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.9.0+cu111'
>>> torch.cuda.is_available()
True
>>>
研究了一天了没成功,求大佬指点,有没有在RTX30系列显卡cuda11.1上配置好环境的,万分感激!