Skip to content

Commit 8600c49

Browse files
EugenHotajFelipe Mello
authored andcommitted
[EZ] Fix set_torch_num_threads in multi-node. (#2164)
1 parent 99052bb commit 8600c49

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torchtune/training/_distributed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def set_torch_num_threads() -> None:
111111
things like CPU affinity is set.
112112
"""
113113
num_threads = os.cpu_count() // (
114-
torch.distributed.get_world_size() if torch.distributed.is_initialized() else 1
114+
torch.cuda.device_count() if torch.cuda.is_available() else 1
115115
)
116116
torch.set_num_threads(num_threads)
117117
_log.info(f"Set intra op parallelism no. of threads to {num_threads}")

0 commit comments

Comments
 (0)