Skip to content

Commit

Permalink
Cast environment variables to integers
Browse files Browse the repository at this point in the history
  • Loading branch information
cbkerr committed Dec 5, 2024
1 parent 6caa763 commit 3592944
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/src/guide/concepts/hoomd-example.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def action_implementation(job, communicator):

def action(*jobs):
"""Execute actions on directories in parallel using HOOMD-blue."""
processes_per_directory = os.environ['ACTION_PROCESSES_PER_DIRECTORY']
processes_per_directory = int(os.environ['ACTION_PROCESSES_PER_DIRECTORY'])
communicator = hoomd.communicator.Communicator(ranks_per_partition=processes_per_directory)
action_implementation(jobs[communicator.partition], communicator)
# ANCHOR_END: action
Expand Down
2 changes: 1 addition & 1 deletion doc/src/guide/concepts/multiprocessing-example.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def action_implementation(job):

def action(*jobs):
"""Process any number of jobs in parallel with the multiprocessing package."""
processes = os.environ.get('ACTION_THREADS_PER_PROCESS', multiprocessing.cpu_count())
processes = int(os.environ.get('ACTION_THREADS_PER_PROCESS', multiprocessing.cpu_count()))
if hasattr(os, 'sched_getaffinity'):
processes = len(os.sched_getaffinity(0))

Expand Down

0 comments on commit 3592944

Please sign in to comment.