Skip to content

Commit 4c10232

Browse files
authored
set allow_growth in default_tf_session_config (#1067)
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.
1 parent 8cf52fd commit 4c10232

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

deepmd/env.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def get_tf_session_config() -> Any:
119119
set_tf_default_nthreads()
120120
intra, inter = get_tf_default_nthreads()
121121
config = tf.ConfigProto(
122+
gpu_options=tf.GPUOptions(allow_growth=True),
122123
intra_op_parallelism_threads=intra, inter_op_parallelism_threads=inter
123124
)
124125
return config

0 commit comments

Comments
 (0)