Skip to content

Commit

Permalink
Merge pull request #578 from RasmusOrsoe/deployer_threds
Browse files Browse the repository at this point in the history
Add check for torch threads in deployer
  • Loading branch information
RasmusOrsoe authored Sep 5, 2023
2 parents 27fb655 + 1e791f3 commit 7857fb8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/graphnet/deployment/i3modules/deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ def __init__(
"""
# This makes sure that one worker cannot access more
# than 1 core's worth of compute.
torch.set_num_threads(1)
torch.set_num_interop_threads(1)

if torch.get_num_interop_threads() > 1:
torch.set_num_interop_threads(1)
if torch.get_num_threads() > 1:
torch.set_num_threads(1)
# Check
if isinstance(graphnet_modules, list):
self._modules = graphnet_modules
Expand Down

0 comments on commit 7857fb8

Please sign in to comment.