Skip to content

Commit 3b10c9c

Browse files
wanghan-iapcmHan Wang
andauthored
fix(pt): expansion of get_default_nthreads() (#5196)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Fixed thread configuration so inter-op and intra-op thread counts are assigned and applied correctly, improving multi-threaded performance behavior. * Updated fallback for inter-op thread count to use the appropriate inter-op environment variable when the primary value is unset, preserving expected defaults across environments. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Han Wang <wang_han@iapcm.ac.cn>
1 parent 24b509d commit 3b10c9c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

deepmd/env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def get_default_nthreads() -> tuple[int, int]:
138138
), int(
139139
os.environ.get(
140140
"DP_INTER_OP_PARALLELISM_THREADS",
141-
os.environ.get("TF_INTRA_OP_PARALLELISM_THREADS", "0"),
141+
os.environ.get("TF_INTER_OP_PARALLELISM_THREADS", "0"),
142142
)
143143
)
144144

deepmd/pt/utils/env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191

9292
# throw warnings if threads not set
9393
set_default_nthreads()
94-
inter_nthreads, intra_nthreads = get_default_nthreads()
94+
intra_nthreads, inter_nthreads = get_default_nthreads()
9595
if inter_nthreads > 0: # the behavior of 0 is not documented
9696
torch.set_num_interop_threads(inter_nthreads)
9797
if intra_nthreads > 0:

0 commit comments

Comments
 (0)