Skip to content

Commit f58a2fa

Browse files
authored
Merge pull request #1859 from cuthbertLab/define_cpus_early
fix runParallel
2 parents b8306fc + 0893a80 commit f58a2fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

music21/common/parallel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def runParallel(iterable,
116116
unpackIterable=unpackIterable,
117117
updateSendsIterable=updateSendsIterable)
118118

119+
numCpus = cpus()
119120
iterLength = len(iterable)
120121
totalRun = 0
121122
if updateFunction is None:
@@ -147,7 +148,6 @@ def callUpdate(ii):
147148
callUpdate(0)
148149
from joblib import Parallel, delayed # type: ignore
149150

150-
numCpus = cpus()
151151
with Parallel(n_jobs=numCpus) as para:
152152
delayFunction = delayed(parallelFunction)
153153
while totalRun < iterLength:

0 commit comments

Comments
 (0)