运行setup.py无法编译spconv的问题--ubuntu18.04

本人电脑配置Ubuntu18.04,cuda10.1,cmake3.13.5,python3.7,pytorch1.4

编译成功的spconv文件下载于:

https://github.com/jinfagang/spconv

执行python setup.py bdist_wheel时遇到各种问题,主要是returned non-zero exit status 1或returned non-zero exit status 2以及编译过程中的

The CUDA compiler  "/usr/bin/nvcc"  is not able to compile a simple test program.或者recipe for target 'src/spconv/CMakeFiles/spconv.dir/all' failed

经过一番捣鼓,最终成功安装spconv 

关于以上问题,解决方法如下

1.The CUDA compiler  "/usr/bin/nvcc"  is not able to compile a simple test program.

在if (SPCONV_BuildCUDA)上添一句 set(CMAKE_CUDA_COMPILER "/usr/local/cuda/bin/nvcc"),如下图所示

2.recipe for target 'src/spconv/CMakeFiles/spconv.dir/all' failed

将/src/spconv/all.cc文件中的jit::删掉

遇到如下问题,我的解决方法是再重新运行一次python setup.py bdist_wheel就不出现这个问题了

CMake Error at CMakeLists.txt:23 (find_package):
  By not providing "FindTorch.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Torch", but
  CMake did not find one.

  Could not find a package configuration file provided by "Torch" with any of
  the following names:

    TorchConfig.cmake
    torch-config.cmake

  Add the installation prefix of "Torch" to CMAKE_PREFIX_PATH or set
  "Torch_DIR" to a directory containing one of the above files.  If "Torch"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

编译完成后既是如下所示

creating 'dist/spconv-1.1-cp37-cp37m-linux_x86_64.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'spconv/__init__.py'
adding 'spconv/conv.py'
adding 'spconv/functional.py'
adding 'spconv/libspconv.so'
adding 'spconv/modules.py'
adding 'spconv/ops.py'
adding 'spconv/pool.py'
adding 'spconv/spconv_utils.cpython-37m-x86_64-linux-gnu.so'
adding 'spconv/spconv_utils.cpython-37m-x86_64-linux-gnu.so.1'
adding 'spconv/spconv_utils.cpython-37m-x86_64-linux-gnu.so.1.1'
adding 'spconv/test_utils.py'
adding 'spconv/utils/__init__.py'
adding 'spconv-1.1.dist-info/LICENSE'
adding 'spconv-1.1.dist-info/METADATA'
adding 'spconv-1.1.dist-info/WHEEL'
adding 'spconv-1.1.dist-info/top_level.txt'
adding 'spconv-1.1.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel

然后进入dist文件夹查看是否有whl文件

(pytorch) root@root-NP5570M4:~$ pip install /home/root/spconv/dist/spconv-1.1-cp37-cp37m-linux_x86_64.whl 
Processing ./spconv/dist/spconv-1.1-cp37-cp37m-linux_x86_64.whl
Installing collected packages: spconv
Successfully installed spconv-1.1

运行second.pytorch的代码时会出现cudahash:completely failed to build.Cuda error XXX in line 194:an illegal memory access was encountered错误

经过如下修改,问题得到解决。

在src/spconv/indice.cu文件夹,找到如下代码,并修改。注释掉的是原本的代码,第二行是修改的代码。修改后能够顺利运行训练的评估代码。

//table.Initialize(numActIn, 2.0, 4);
table.Initialize(numActIn, 4.0, 4);

 

  • 8
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 21
    评论
评论 21
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值