Tensorflow_gpu 2.3 + cuda10.2 多核训练踩坑经历

Tensorflow_gpu 2.3 + cuda10.2 多核训练踩坑经历


本渣渣实验室电脑的配置是4*2080ti,系统是windows server 2019,环境是:
anaconda + tensorflow2.3 +python3.8,在GPU单核训练中运行正常,但尝试了深层网络之后报错:

Resource exhausted: OOM when allocating tensor with shape [ , ]

具体维度忘了,就是GPU显存不足。之后开始尝试GPU多核训练。尝试了两种方法:

  1. os.environ[‘CUDA_VISIBLE_DEVICES’] = ‘0,1,2,3’ ,尝试失败,只运行了一个gpu。
  2. model = keras.utils.training_utils.multi_gpu_model(M, gpus=4),尝试失败,检测不到四个GPU,具体错误如下:
    we expect the following devices to be available: [’/cpu:0’, ‘/gpu:0’, ‘/gpu:1’, ‘/gpu:2’, ‘/gpu:3’]. However this machine only has: [’/cpu:0’, ‘/xla_gpu:0’, ‘/xla_gpu:1’, ‘/xla_cpu:0’]. Try reducing gpus.
  3. strategy = tf.distribute.MirroredStrategy(devices=["/gpu:0", “/gpu:1”, ‘/gpu:2’, ‘/gpu:3’]),尝试失败,原因与2.一致。

但是前面加载tensorflow和cudnn的时候确实是检测得到四个GPU的:

在这里插入图片描述
之后在经过在github上找到解释:

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值