TensorFlow性能优化

el_submit 工具命令如下:

export HADOOP_CONF_DIR=/etc/emr-gpu-yarn/hadoop-conf-gn5
el_submit -x true -t tensorflow-ps -a wangxuan-wd -m local -f ./ -pn 9 -pc 1 -pm 10000 -wn 32 -wc 8 -wg 0 -wm 10000 -conf /etc/emr-gpu-yarn/hadoop-conf-2.7.2-1.2.99 -c python client.py --conf wd.dataflow.xml

参数意义:

-x:exit,exit on one container success
-t:application type,default: tensorflow
-a:  application name, default :tensorflow_on_yarn
-m: model, application execute model,  local, virtual-env , docker, default: local
-f: files. dependency files which used to execute,can be files or folders
-pn: PS_num,default 1
-pc: PS_CPU, default 1
-pm: PS_memory,default 1000
-wn: worker number 1
-wnpg:每张GPU卡上跑的worker个数
-wc: worker CPU 1
-wg: worker GPU
-wm: worker memory
-conf: conf dir of hadoop
-c: command. the command to execute eg: -c python a.py

pipeline优化性能:
tf.data.Dataset.prefetch(n) 变换:
解耦了 数据产生的时间 和 数据消耗的时间
prefetch(n)

map变换:并行输入元素预处理
tf.data.Dataset.map变换
num_parallel_calls 制定并行的级别,最优值取决于硬件。简单原则:设置为CPU的核心数

并行读取并解析文件(并行I/O):
tf.contrib.data.parallel_interleave 转换
以将 “从多个文件中提取数据并解析 ”这一过程并行化。
同时读取的文件的数目可以通过参数 cycle_length 来指定。

你可能感兴趣的:(TensorFlow性能优化)