电脑环境
GPU:GTX1060/6G
系统:ubuntu14.04
python2.7
tensorflow1.4.0
cuda8.0
cudnn6.0
在跑https://github.com/MarvinTeichmann/KittiSeg.git的demo时
运行python demo.py --input_image data/demo/demo.png后,报错
Dst tensor is not initialized
分析:可能是我同时运行的其他程序也用到了GPU,造成GPU资源不够或冲突了。
可以以限制使用GPU资源,
指定使用部分
CUDA_VISIBLE_DEVICES=1 python main.py
限制显存使用
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.7) sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))
更详细设置可以参考
http://www.cnblogs.com/darkknightzh/p/6591923.html
http://stackoverflow.com/questions/36668467/change-default-gpu-in-tensorflow
http://stackoverflow.com/questions/37893755/tensorflow-set-cuda-visible-devices-within-jupyter