ubuntu常见问题(持续更新)

1、nvcc warning : The ‘compute_20’, ‘sm_20’, and ‘sm_21’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc warning : The ‘compute_20’, ‘sm_20’, and ‘sm_21’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).

到cmake后产生的OpencvConfig.cmake文件,找到如下代码:

# Version Compute Capability from which OpenCV has been compiled is remembered
set(OpenCV_COMPUTE_CAPABILITIES -gencode;arch=compute_11,code=sm_11;-gencode;arch=compute_12,code=sm_12;-gencode;arch=compute_13,code=sm_13;-gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_20,code=sm_21;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_30,code=compute_30)

将”-gencode ;arch=compute_11,code=sm_11”;-gencode;arch=compute_12,code=sm_12;-gencode;arch=compute_13,code=sm_13; 等删除。

主要因为此架构在CUDA过时~~将来也将不支持

以上若无果:

在cmakelist中关闭cuda~~

或者在cmake时加上参数-D BUILD_opencv_gpu=OFF

2、在编译caffe的Mkefile.config时遇到报错

nvcc warning : The ‘compute_20’, ‘sm_20’, and ‘sm_21’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).

原因是,Makefile中采用了CUDA的compute capability 2.0和2.1,这是两种计算能力。安装的CUDA版本是8.0,但 从CUDA 8.0开始compute capability 2.0和2.1被弃用了,所以可以将-gencode arch=compute_20,code=sm_20 和-gencode arch=compute_20,code=sm_21这两行删除即可。

安装opencv3.3.1测试报错!
Traceback (most recent call last): File “opencvtest.py”, line 1, in import cv2 ImportError: No module named cv2
3、Ubuntu16.04上使用Python调用OpenCV需要安装对应的python包:

sudo apt-get install python-opencv

这个还是重装Ubuntu才测试成功的。可以检查一下安装版本
pkg-config --modversion opencv
我测试的是3.3.1
但是用

my@my-by-HP:~$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'2.4.9.1'

4、 import cv2
ImportError: /home/heyuxuan/.local/lib/python2.7/site-packages/torch/lib/libgomp.so.1: version `GOMP_4.0’ not found (required by /usr/lib/x86_64-linux-gnu/libsoxr.so.0)

参考http://blog.csdn.net/sinat_33621733/article/details/53710868
具体可以参考自己的错误来操作。

ImportError: /home/zdyd/anaconda2/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/zdyd/caffe/python/caffe/_caffe.so)  

strings /home/zdyd/anaconda2/bin/../lib/libstdc++.so.6 | grep GLIBCXX  

发现确实没有,

find / -iname libstdc++.so.6.0.2*  

找到最新版本在下面的文件家中存在,

strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 | grep GLIBCXX  

确实有,下一步拷到相关目录

cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 /home/zdyd/anaconda2/bin/../lib/  

在到之前的目录

cd /home/zdyd/anaconda2/bin/../lib/  

删除原来的:

rm -rf libstdc++.so.6  

建立软链接:

ln -s libstdc++.so.6.0.21 libstdc++.so.6  

再次查看已存在

strings /home/zdyd/anaconda2/bin/../lib/libstdc++.so.6 | grep GLIBCXX  

注意:一定要看好是自己的那个目录的相关版本不存在,不要瞎改,

5、Traceback (most recent call last):
File “test.py”, line 6, in
from src.data_loader import ImageDataLoader
File “/home/heyuxuan/ROOT/src/data_loader.py”, line 5, in
import pandas as pd
ImportError: No module named pandas

sudo apt-get install python-pandas

pandas可以通过pip安装,但要安装相关的依赖包。

6、import h5py
ImportError: No module named h5py

安装h5py的命令如下:

sudo pip install cython
sudo apt-get install libhdf5-dev

sudo pip install h5py

安装完成后可以用如下命令测试:

python 

import h5py

7、heyuxuan@heyuxuan-by-HP:~/ROOT$ python test.py
Pre-loading the data. This may take a while…
Loaded 100 / 182
Completed laoding 182 files
THCudaCheck FAIL file=/b/wheel/pytorch-src/torch/lib/THC/generic/THCStorage.cu line=66 error=30 : unknown error
Traceback (most recent call last):
File “test.py”, line 37, in
net.cuda()
File “/home/heyuxuan/.local/lib/python2.7/site-packages/torch/nn/modules/module.py”, line 147, in cuda
return self._apply(lambda t: t.cuda(device_id))
File “/home/heyuxuan/.local/lib/python2.7/site-packages/torch/nn/modules/module.py”, line 118, in _apply
module._apply(fn)
File “/home/heyuxuan/.local/lib/python2.7/site-packages/torch/nn/modules/module.py”, line 118, in _apply
module._apply(fn)
File “/home/heyuxuan/.local/lib/python2.7/site-packages/torch/nn/modules/module.py”, line 118, in _apply
module._apply(fn)
File “/home/heyuxuan/.local/lib/python2.7/site-packages/torch/nn/modules/module.py”, line 118, in _apply
module._apply(fn)
File “/home/heyuxuan/.local/lib/python2.7/site-packages/torch/nn/modules/module.py”, line 124, in _apply
param.data = fn(param.data)
File “/home/heyuxuan/.local/lib/python2.7/site-packages/torch/nn/modules/module.py”, line 147, in
return self._apply(lambda t: t.cuda(device_id))
File “/home/heyuxuan/.local/lib/python2.7/site-packages/torch/_utils.py”, line 65, in _cuda
return new_type(self.size()).copy_(self, async)
File “/home/heyuxuan/.local/lib/python2.7/site-packages/torch/cuda/init.py”, line 280, in new
return super(_CudaBase, cls).new(cls, *args, **kwargs)
RuntimeError: cuda runtime error (30) : unknown error at /b/wheel/pytorch-src/torch/lib/THC/generic/THCStorage.cu:66

8、heyuxuan@heyuxuan-by-HP:~/ROOT$ python train.py
Pre-loading the data. This may take a while…
Loaded 100 / 2439
Loaded 200 / 2439
Loaded 300 / 2439
Loaded 400 / 2439
Loaded 500 / 2439
Loaded 600 / 2439
Loaded 700 / 2439
Loaded 800 / 2439
Loaded 900 / 2439
Loaded 1000 / 2439
Loaded 1100 / 2439
Loaded 1200 / 2439
Loaded 1300 / 2439
Loaded 1400 / 2439
Loaded 1500 / 2439
Loaded 1600 / 2439
Loaded 1700 / 2439
Loaded 1800 / 2439
Loaded 1900 / 2439
Loaded 2000 / 2439
Loaded 2100 / 2439
Loaded 2200 / 2439
Loaded 2300 / 2439
Loaded 2400 / 2439
Completed laoding 2439 files
Pre-loading the data. This may take a while…
Loaded 100 / 261
Loaded 200 / 261
Completed laoding 261 files
THCudaCheck FAIL file=/b/wheel/pytorch-src/torch/lib/THC/generic/THCStorage.cu line=66 error=30 : unknown error
Traceback (most recent call last):
File “train.py”, line 71, in
net = CrowdCounter(ce_weights=class_wts)
File “/home/heyuxuan/ROOT/src/crowd_count.py”, line 14, in init
ce_weights = ce_weights.cuda()
File “/home/heyuxuan/.local/lib/python2.7/site-packages/torch/_utils.py”, line 65, in _cuda
return new_type(self.size()).copy_(self, async)
File “/home/heyuxuan/.local/lib/python2.7/site-packages/torch/cuda/init.py”, line 280, in new
return super(_CudaBase, cls).new(cls, *args, **kwargs)
RuntimeError: cuda runtime error (30) : unknown error at /b/wheel/pytorch-src/torch/lib/THC/generic/THCStorage.cu:66

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值