Skip to content

Commit

Permalink
fix default nproc for macos and windows (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
njzjz authored Jan 5, 2024
1 parent 1954d5d commit a2b0550
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
else:
try:
self.nproc = len(os.sched_getaffinity(0))
except AttributeError:
# macos and windows
self.nproc = os.cpu_count()
self.cutoff = cutoff
self.n_clusters = n_clusters
self.n_each = n_each
Expand Down

0 comments on commit a2b0550

Please sign in to comment.