Tensorflow--分布式训练

本文介绍了如何在Tesla K20c集群上进行多节点、多GPU的TensorFlow分布式训练。实验中,配置了一个CPU节点作为参数服务器,两个GPU节点各使用2个GPU作为工作服务器,探讨了同步和异步两种分布式训练模式。
摘要由CSDN通过智能技术生成

实验任务:

集群上多节点多GPU分布式训练

CUDA_VISIBLE_DEVICES=” python distributed.py –job_name=ps –task_index=0

CUDA_VISIBLE_DEVICES=’0’ python distributed.py –job_name=worker –task_index=0

CUDA_VISIBLE_DEVICES=’1’ python distributed.py –job_name=worker –task_index=1

CUDA_VISIBLE_DEVICES=’0’ python distributed.py –job_name=worker –task_index=2

CUDA_VISIBLE_DEVICES=’1’ python distributed.py –job_name=worker –task_index=3

实验环境:

TeslaK20c集群,使用了3个节点,其中1个节点使用1个cpu作为参数服务器,2个节点分别使用2个gpu作为工作服务器,分布式训练方式可以选择同步和异步两种。

# encoding:utf-8
import math
import tempfile
import time
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data

flags = tf.app.flags

flags.DEFINE_string('data_dir', '/home/zhangzhaoyu/incubator-mxnet-master/example/image-classification/data', 'Directory  for storing mnist data')
flags.DEFINE_integer('hidden_units', 100, 'Number of units in the hidden layer of the NN')
flags.DEFINE_integer('train_steps', 100000, 'Number of training steps to perform')
flags.DEFINE_integer('batch_size', 100, 'Training batch size ')
flags.DEFINE_float('learning_rate', 0.01, 'Learning rate')

flags.DEFINE_string('ps_hosts', '172.16.1.182:2222', 'Comma-separated list of hostname:port pairs')

flags.DEFINE_string('worker_hosts', '172.16.1.183:2223,172.16.1.183:2224,172.16.1.187:2225,172.16.1.187:2226',
                    'Comma-separated list of hostname:p
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值