Skip to content

Commit

Permalink
Merge pull request #65 from glotzerlab/fix/integer-env-vars
Browse files Browse the repository at this point in the history
Cast environment variables to integers
  • Loading branch information
joaander authored Dec 5, 2024
2 parents 6caa763 + 4358c88 commit 3c18956
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/src/contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ The following people have contributed to the development of **row**:
* Joseph Burkhart, University of Michigan
* Kate Jensen, University of Michigan
* Tim Moore, University of Michigan
* Corwin Kerr, University of Michigan
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
1 change: 1 addition & 0 deletions doc/src/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
properly escaped in the bash script output.
* Typographical errors in the documentation.
* The documentation now builds correctly with mdbook 0.4.43.
* Example code converts environment variables to ints where needed.

## 0.3.1 (2024-10-04)

Expand Down

0 comments on commit 3c18956

Please sign in to comment.