Skip to content

Commit

Permalink
fix default nproc for macos and windows
Browse files Browse the repository at this point in the history
  • Loading branch information
njzjz authored Jan 5, 2024
1 parent 1954d5d commit 260ec11
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mddatasetbuilder/datasetbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,14 @@ def __init__(
self.clusteratom = clusteratom if clusteratom else atomname
self.atombondtype = []
self.stepinterval = stepinterval
self.nproc = nproc if nproc else len(os.sched_getaffinity(0))
if nproc:
self.nproc = nproc

Check warning on line 128 in mddatasetbuilder/datasetbuilder.py

View check run for this annotation

Codecov / codecov/patch

mddatasetbuilder/datasetbuilder.py#L128

Added line #L128 was not covered by tests
else:
try:
self.nproc = len(os.sched_getaffinity(0))
except AttributeError:

Check warning on line 132 in mddatasetbuilder/datasetbuilder.py

View check run for this annotation

Codecov / codecov/patch

mddatasetbuilder/datasetbuilder.py#L132

Added line #L132 was not covered by tests
# macos and windows
self.nproc = os.cpu_count()

Check warning on line 134 in mddatasetbuilder/datasetbuilder.py

View check run for this annotation

Codecov / codecov/patch

mddatasetbuilder/datasetbuilder.py#L134

Added line #L134 was not covered by tests
self.cutoff = cutoff
self.n_clusters = n_clusters
self.n_each = n_each
Expand Down

0 comments on commit 260ec11

Please sign in to comment.