-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathparameter_server.py
executable file
·43 lines (32 loc) · 1.01 KB
/
parameter_server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import configs
import tensorflow as tf
def main (FLAGS):
cluster = configs.distributed.get_cluster(FLAGS)
cluster = tf.train.ClusterSpec(cluster)
if FLAGS.debug:
tf.logging.set_verbosity(tf.logging.DEBUG)
server = tf.train.Server (
cluster,
job_name='ps',
config=tf.ConfigProto(**configs.tf.session_configs['single_cpu']),
task_index=FLAGS.task_index
)
return server.join()
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
parser = configs.distributed.add_argparse_args(parser)
parser.add_argument (
'--task_index', type=int, required=True,
help='Index of parameter server in cluster.'
)
parser.add_argument (
'--debug', action='store_true',
help='Output debugging information.'
)
FLAGS = parser.parse_args()
exit(main(FLAGS))