pytorch no kernel image is available for execution on the device
/home/caocao/anaconda3/compiler_compat/ld: cannot find -lpthread
/home/caocao/anaconda3/compiler_compat/ld: cannot find -lc
collect2: error: ld returned 1 exit status
I have the same error, then I input this:
sudo ln -s /usr/local/cuda-8.0/lib64/libcufft.so /usr/local/lib/libcufft.so,
it work well.
cp /usr/lib/x86_64-linux-gnu/libc.so /home/caocao/anaconda3/lib/libc.so
cp /usr/lib/x86_64-linux-gnu/libpthread.so /home/caocao/anaconda3/lib/libpthread.so
cffi.error.VerificationError: CompileError: command 'gcc' failed with exit status 1
ln -s /usr/local/cuda-9.0/include/* /home/caocao/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC/
ln -s /usr/local/cuda-9.0/* /usr/local/cuda/*
ARCH = sm_52
export PATH = / usr / local / cuda-9.0 / bin $ {PATH:+:$ {PATH}}
export CPATH = / usr / local / cuda-9.0 / include $ {CPATH:+:$ {CPATH}}
export LD_LIBRARY_PATH =在/ usr /本地/ CUDA的9.0 / lib64下$ {LD_LIBRARY_PATH:+:$ {LD_LIBRARY_PATH}}`
看起来它没有编译nnd_cuda.cu
。是否在setup.py
脚本中正确指定了?您的用户是否允许在磁盘上写入文件?
export CUDA_PATH = / usr / local / cuda /
export CXXFLAGS =“ - std = c ++ 11”
export CFLAGS =“ - std = c99”
export PATH = / usr / local / cuda-9.0 / bin $ {PATH:+:$ {PATH}}
export CPATH = / usr / local / cuda-9.0 / include $ {CPATH:+:$ {CPATH}}
export LD_LIBRARY_PATH =在/ usr /本地/ CUDA的9.0 / lib64下$ {LD_LIBRARY_PATH:+:$ {LD_LIBRARY_PATH}}
ARCH= -gencode arch=compute_52,code=[sm_52,compute_52]
类似问题还有'ImportError ../lib/libstdc++.so.6:未找到版本`CXXABI_1.3.8'(xxx要求)','ImportError ../lib/libstdc++.so.6:version`CXXABI_1.3.9'找不到(XXX要求)'等。
cp /usr/lib/x86_64-linux-gnu/libgomp.so.1 /home/caocao/anaconda3/lib/libgomp.so.1
cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /home/caocao/anaconda3/lib/libstdc++.so.6
cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /home/caocao/anaconda3/libstdc++.so.6
ln -s /usr/lib/x86_64-linux-gnu/libgomp.so.1 /home/caocao/anaconda3/libgomp.so.1
这种报错情况一般出现在阿纳康达环境的Python的程序中,原因是水蟒对应目录下的“libgomp.so.1”和“++的libstdc.so.6”动态库文件(LIB)中相关模块的版本比较旧,不包含相应版本模块导致的。
ln -s /usr/lib/x86_64-linux-gnu/libgomp.so.1 /home/caocao/anaconda3/lib/python3.6/site-packages/torch/lib/libgomp.so.1
系统中动态库存放路径在:/ usr / lib / x86_64-linux-gnu /或/ usr / lib /
森蚺中动态库存放路径是:〜/ anaconda2 / lib目录
查看的的Linux的系统动态库文件包含的模块版本:
字符串/usr/lib/libstdc++.so.6 | grep'CXXABI”
strings libstdc ++。so.6 | grep'CXXABI_1.3.8'
或者
字符串/usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep'CXXABI”
输出:
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_1.3.8
CXXABI_1.3.9
CXXABI_TM_1
CXXABI_FLOAT128
查看蟒蛇路径下动态库文件所包含的模块版本:
字符串anaconda2 / lib / libstdc ++。so.6 | grep'CXXABI'
输出:
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_TM_1
系统目录下的文件包含所需模块的版本 'CXXABI_1.3.8' 和 'CXXABI_1.3.9',复制系统目录下的动态库文件替换掉水蟒目录下的动态库文件,问题就解决了。
同样可以使用字符串指令查看蟒蛇中和系统下libgomp.so.1文件中分别包含的版本:
字符串libgomp.so.1 | grep的“GOMP”
如果系统目录的lib中也不包含所需模块,可以尝试使用以下命令更新动态库文件:
LD_LIBRARY_PATH = / usr / local / lib64 /:$ LD_LIBRARY_PATH
export LD_LIBRARY_PATH
sudo add-apt-repository ppa:ubuntu-toolchain -r / test
sudo apt-get update
sudo apt-get install gcc-4.9 g ++ - 4.9
--- - ----------------
作者: - 牧野 -
来源:CSDN
原文:HTTPS://blog.csdn.net/dcrmg/article/details/78358279
版权声明:本文为博主原创文章,转载请附上博文链接!
/home/caocao/anaconda3/bin/python /home/caocao/Downloads/stnm.pytorch-master/script/test.py
Traceback (most recent call last):
error in BilinearSampler.updateOutput: no kernel image is available for execution on the device
File "/home/caocao/Downloads/stnm.pytorch-master/script/test.py", line 31, in <module>
out = s(canvas, fgimg, fggrid, fgmask)
File "/home/caocao/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__
result = self.forward(*input, **kwargs)
File "/home/caocao/Downloads/stnm.pytorch-master/script/modules/stnm.py", line 9, in forward
return self.f(canvas, fgimg, fggrid, fgmask)
File "/home/caocao/Downloads/stnm.pytorch-master/script/functions/stnm.py", line 19, in forward
stnm.BilinearSamplerBHWD_updateOutput_cuda(canvas, fgimg, fggrid, fgmask, output)
File "/home/caocao/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/__init__.py", line 197, in safe_call
result = torch._C._safe_call(*args, **kwargs)
torch.FatalError: aborting at /home/caocao/Downloads/stnm.pytorch-master/script/src/stnm_cuda.c:60