磐创AI专注分享原创AI技术文章翻译 | fendouai编辑 | 磐石【磐创AI导读】:本文编译自tensorflow官方网站,详细介绍了Tensorflow中多GPU的使用。
欢迎大家点击上方蓝字关注我们的公众号:磐创AI。目录:介绍记录设备状态手动分配状态允许GPU内存增长在多GPU系统是使用单个GPU使用多个 GPU一. 介绍在一个典型的系统中,有多个计算设备。
# 创建一个计算图a tf.constant(, shape, namea)b tf.constant(, shape, nameb)c tf.matmul(a, b)# 创建一个
如果您想在不同的GPU上运行,则需要明确指定首选项:# 创建一个计算图with tf.device(device:GPU:2): a tf.constant(, shape, namea) b
# 创建计算图with tf.device(device:GPU:2): a tf.constant(, shape, namea) b tf.constant(, shape, name