From 1954d5de1a1ce3450b84a5fcbb85c49a156a6962 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Wed, 15 Nov 2023 18:24:22 -0500 Subject: [PATCH] set default nproc to the number of logical CPUs the current process can use (#191) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- mddatasetbuilder/datasetbuilder.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mddatasetbuilder/datasetbuilder.py b/mddatasetbuilder/datasetbuilder.py index 65d7c57..5b6d320 100644 --- a/mddatasetbuilder/datasetbuilder.py +++ b/mddatasetbuilder/datasetbuilder.py @@ -21,7 +21,6 @@ import tempfile import time from collections import Counter, defaultdict -from multiprocessing import cpu_count import numpy as np from ase.data import atomic_numbers @@ -125,7 +124,7 @@ def __init__( self.clusteratom = clusteratom if clusteratom else atomname self.atombondtype = [] self.stepinterval = stepinterval - self.nproc = nproc if nproc else cpu_count() + self.nproc = nproc if nproc else len(os.sched_getaffinity(0)) self.cutoff = cutoff self.n_clusters = n_clusters self.n_each = n_each