Skip to content

Commit

Permalink
Merge pull request #161 from gerlero/cases
Browse files Browse the repository at this point in the history
Fix AsyncFoamCase cpus handling
  • Loading branch information
gerlero authored Aug 25, 2024
2 parents ed985c9 + 9a276c1 commit b11e504
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions foamlib/_cases/_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,13 @@ async def run(
cmd=cmd, script=script, parallel=parallel, check=check
):
if cpus is None:
cpus = 1

if name == "run" and kwargs.get("parallel", False):
cpus = min(self._nprocessors, cpus)
if name == "run":
if kwargs.get("parallel", False):
cpus = max(self._nprocessors, 1)
else:
cpus = 1
else:
cpus = 0

async with self._cpus(cpus):
await getattr(self, name)(*args, **kwargs)
Expand Down

0 comments on commit b11e504

Please sign in to comment.