Skip to content

Commit

Permalink
set allow_growth in default_tf_session_config (#1067)
Browse files Browse the repository at this point in the history
Currently, TF only initializes GPUs once, and never releases memory. As a result, we must set `allow_growth` in the first Session (or every session?), otherwise it doesn't work.

Please confirm the `allow_growth` config in `trainer.py` is expected, otherwise we should remove it instead.
  • Loading branch information
njzjz authored Aug 31, 2021
1 parent 8cf52fd commit 4c10232
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions deepmd/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def get_tf_session_config() -> Any:
set_tf_default_nthreads()
intra, inter = get_tf_default_nthreads()
config = tf.ConfigProto(
gpu_options=tf.GPUOptions(allow_growth=True),
intra_op_parallelism_threads=intra, inter_op_parallelism_threads=inter
)
return config
Expand Down

0 comments on commit 4c10232

Please sign in to comment.