为什么尝试额外运行一段时间后我的GPU Tensorflow崩溃?

时间:2019-04-04 01:09:01

标签: tensorflow anaconda syntax-error spyder

我是Tensorflow的新手,我正在Anaconda中使用Spyder安装GPU。我的程序中反复出现一个问题,在尝试多次运行一个文件后,它会崩溃,并显示“您的CPU支持该TensorFlow二进制文件未编译为使用的指令:AVX AVX2”。

关闭原始控制台并打开一个新控制台有时会让我再次运行该文件而不会崩溃,但有时却没有。关闭并再次打开整个程序也是一样。

通常情况下,程序运行良好,直到我尝试运行任何张量流操作,例如

with tf.Session() as sess:
    sess.run(tf.global_variables_initializer())
    sess.run(predict_op,...)

程序停止运行直到出现此错误:

2019 20:45:10.359441: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2019 20:45:10.612655: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1405] Found device 0 with properties: 
name: GeForce GTX 970 major: 5 minor: 2 memoryClockRate(GHz): 1.253
pciBusID: 0000:01:00.0
totalMemory: 4.00GiB freeMemory: 3.22GiB
2019 20:45:10.684151: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1405] Found device 1 with properties: 
name: GeForce GTX 970 major: 5 minor: 2 memoryClockRate(GHz): 1.253
pciBusID: 0000:02:00.0
totalMemory: 4.00GiB freeMemory: 3.22GiB
2019 20:45:10.687572: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1484] Adding visible gpu devices: 0, 1
2019 20:45:11.509725: I tensorflow/core/common_runtime/gpu/gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix:
2019 20:45:11.510626: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0 1 
2019 20:45:11.511179: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] 0: N Y 
2019 20:45:11.511725: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] 1: Y N 
2019 20:45:11.512401: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2928 MB memory) ‑> physical GPU (device: 0, name: GeForce GTX 970, pci bus id: 0000:01:00.0, compute capability: 5.2)
2019 20:45:11.901678: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:1 with 2928 MB memory) ‑> physical GPU (device: 1, name: GeForce GTX 970, pci bus id: 0000:02:00.0, compute capability: 5.2)
2019 20:45:12.543674: E tensorflow/stream_executor/cuda/cuda_blas.cc:459] failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED
2019 20:45:13.105336: E tensorflow/stream_executor/cuda/cuda_dnn.cc:352] Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR

1 个答案:

答案 0 :(得分:0)

我很可能崩溃了,因为Tensorflow在分配VRAM方面很贪心。请查看答案here