遇到的问题 0.tensorflow (核心已转储) env "PYTHONUNBUFFERED"="1" " 1.failed initializing StreamExecutor for CUDA device ordinal 0 2.CUDA_ERROR_INVALID_DEVICE: invalid device ordinal 3.No session factory registered for the given ses
遇到的问题
0.tensorflow (核心已转储) env "PYTHONUNBUFFERED"="1" "
1.failed initializing StreamExecutor for CUDA device ordinal 0
2.CUDA_ERROR_INVALID_DEVICE: invalid device ordinal
3.No session factory registered for the given session options: {target: "/device:GPU:0" config: }
4.ImportError: libcudnn.so.7: cannot open shared object file: No such file or directory
解决方法:
虽然不知道是哪一个具体解决了哪一个
1.确定tensorflow-gpu的版本对应的CUDA喝cuDNN版本一定是对的,1.12.0对应的分别是9.0和7.0
修改CUDA直接在.bashrc文件里修改即可。我根据搜索的结果由
CUDA_VISIBLE_DEVICES=0 CUDA_HOME=/usr/local/cuda-9.0 PATH="$PATH:/usr/local/cuda-9.0/bin" LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-9.0/lib64:/usr/local/cuda-8.0/lib64"
修改为了
CUDA_VISIBLE_DEVICES=0#这个记得加 export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH="/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH" export PATH=/usr/local/cuda/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"
并且使用source ~/.bashrc使其生效
将libcudnn.so.7文件拷贝到了usr/local/cuda/lib64目录下(但是觉得这个不是这个问题)
玄学,就好了。