11import os,sys
2- import tensorflow as tf
2+ from deepmd.env import tf
3+ from deepmd.env import get_tf_default_nthreads
34import numpy as np
45import deepmd.cluster.Slurm as Slurm
56import deepmd.cluster.Local as Local
@@ -28,14 +29,6 @@ global_git_branch='@GIT_BRANCH@'
2829global_tf_include_dir='@TensorFlow_INCLUDE_DIRS@'
2930global_tf_libs='@TensorFlow_LIBRARY@'
3031
31- def _get_threads_env () :
32- num_intra_threads = None
33- if 'OMP_NUM_THREADS' in os.environ :
34- num_intra_threads = int(os.environ['OMP_NUM_THREADS'])
35- else :
36- num_intra_threads = 0
37- return num_intra_threads
38-
3932def _is_slurm() :
4033 return "SLURM_JOB_NODELIST" in os.environ
4134
@@ -106,10 +99,6 @@ class RunOptions (object) :
10699 def __init__ (self,
107100 args,
108101 try_distrib = False):
109- # thread settings
110- self.num_intra_threads = _get_threads_env()
111- self.num_inter_threads = 0
112-
113102 # distributed tasks
114103 if try_distrib :
115104 self._try_init_mpi()
@@ -132,8 +121,6 @@ class RunOptions (object) :
132121 if args.restart is not None:
133122 self.restart = os.path.abspath(args.restart)
134123 self.init_mode = "restart"
135- if args.inter_threads is not None :
136- self.num_inter_threads = args.inter_threads
137124
138125 def message (self, msg) :
139126 if self.verbose :
@@ -167,28 +154,32 @@ class RunOptions (object) :
167154 def print_summary(self) :
168155 msg = ""
169156 msg += "---Summary of the training---------------------------------------\n"
170- msg += 'installed to: %s\n' % global_install_prefix
171- msg += 'source : %s\n' % global_git_summ
172- msg += 'source brach: %s\n' % global_git_branch
173- msg += 'source commit: %s\n' % global_git_hash
174- msg += 'source commit at: %s\n' % global_git_date
175- msg += 'build float prec: %s\n' % global_float_prec
176- msg += 'build with tf inc: %s\n' % global_tf_include_dir
157+ msg += 'installed to: %s\n' % global_install_prefix
158+ msg += 'source : %s\n' % global_git_summ
159+ msg += 'source brach: %s\n' % global_git_branch
160+ msg += 'source commit: %s\n' % global_git_hash
161+ msg += 'source commit at: %s\n' % global_git_date
162+ msg += 'build float prec: %s\n' % global_float_prec
163+ msg += 'build with tf inc: %s\n' % global_tf_include_dir
177164 for idx,ii in enumerate(global_tf_libs.split(';')) :
178165 if idx == 0 :
179- msg += 'build with tf lib: %s\n' % ii
166+ msg += 'build with tf lib: %s\n' % ii
180167 else :
181- msg += ' %s\n' % ii
168+ msg += ' %s\n' % ii
182169 if self.is_distrib:
183170 msg += "distributed\n"
184- msg += "ps list: %s\n" % str(self.cluster['ps'])
185- msg += "worker list: %s\n" % str(self.cluster['worker'])
186- msg += "chief on: %s\n" % self.nodename
171+ msg += "ps list: %s\n" % str(self.cluster['ps'])
172+ msg += "worker list: %s\n" % str(self.cluster['worker'])
173+ msg += "chief on: %s\n" % self.nodename
187174 else :
188- msg += "running on: %s\n" % self.nodename
189- msg += "gpu per node: %s\n" % self.gpus
190- msg += "num_inter_threads: %d\n" % self.num_inter_threads
191- msg += "num_intra_threads: %d\n" % self.num_intra_threads
175+ msg += "running on: %s\n" % self.nodename
176+ if self.gpus is None:
177+ msg += "CUDA_VISIBLE_DEVICES: unset\n"
178+ else:
179+ msg += "CUDA_VISIBLE_DEVICES: %s\n" % self.gpus
180+ intra, inter = get_tf_default_nthreads()
181+ msg += "num_intra_threads: %d\n" % intra
182+ msg += "num_inter_threads: %d\n" % inter
192183 msg += "-----------------------------------------------------------------\n"
193184 self.message(msg)
194185
0 commit comments