凛冬将至

从简单的例子开始

0%

GPU使用中的问题

使用GPU训练模型中出现的问题记录

查看GPU状态

1
2
3
# cmd
cd C:\Program Files\NVIDIA Corporation\NVSMI
nvidia-smi.exe

内存溢出

pycharm报错:

1
tensorflow.python.framework.errors_impl.InternalError: Blas xGEMM launch failed : a.shape=[1,1,100], b.shape=[1,100,12544], m=1, n=12544, k=100 [Op:MatMul]

原因是内存溢出

参考stackoverflow,增加两行代码后解决

1
2
physical_devices = tf.config.list_physical_devices('GPU') 
tf.config.experimental.set_memory_growth(physical_devices[0], True)

设置使用量(暂时没起到作用)

1
2
3
gpus = tf.config.experimental.list_physical_devices(device_type='GPU')
for gpu in gpus:
tf.config.experimental.per_process_gpu_memory_fraction = 0.9