Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cast environment variables to integers #65

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading