Skip to content

Commit

Permalink
set gpu options under hvd scenes
Browse files Browse the repository at this point in the history
  • Loading branch information
chengmengli06 committed Feb 22, 2024
1 parent 47940ea commit 8f828df
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions easy_rec/python/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,15 @@ def _create_estimator(pipeline_config, distribution=None, params={}):
train_config = pipeline_config.train_config
gpu_options = GPUOptions(allow_growth=True) # False)

logging.info('train_config.train_distribute=%s[value=%d]' %
(DistributionStrategy.Name(pipeline_config.train_config.train_distribute),
pipeline_config.train_config.train_distribute))

# set gpu options only under hvd scenes
if hvd is not None and pipeline_config.train_config.train_distribute in [
DistributionStrategy.EmbeddingParallelStrategy,
DistributionStrategy.SokStrategy, DistributionStrategy.HorovodStrategy
]:
logging.info('train_config.train_distribute=%s' %
pipeline_config.train_config.train_distribute)
local_rnk = hvd.local_rank()
gpus = tf.config.experimental.list_physical_devices('GPU')
logging.info('local_rnk=%d num_gpus=%d' % (local_rnk, len(gpus)))
Expand Down

0 comments on commit 8f828df

Please sign in to comment.