Skip to content

Commit

Permalink
not use joblib when n_job=1
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxuanzhuang committed May 1, 2024
1 parent 320fca1 commit ebda515
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions package/MDAnalysis/analysis/encore/confdistmatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,25 @@ def conformational_distance_matrix(ensemble,
# Initialize workers. Simple worker doesn't perform fitting,
# fitter worker does.
indices = trm_indices((0, 0), (framesn - 1, framesn - 1))
Parallel(n_jobs=n_jobs, verbose=verbose, require='sharedmem',
max_nbytes=max_nbytes)(delayed(conf_dist_function)(
np.int64(element),
rmsd_coordinates,
distmat,
weights,
fitting_coordinates,
subset_weights) for element in indices)
if n_jobs == 1:
for element in indices:
conf_dist_function(np.int64(element),
rmsd_coordinates,
distmat,
weights,
fitting_coordinates,
subset_weights)
else:
Parallel(n_jobs=n_jobs,
verbose=verbose,
require='sharedmem',
max_nbytes=max_nbytes)(delayed(conf_dist_function)(
np.int64(element),
rmsd_coordinates,
distmat,
weights,
fitting_coordinates,
subset_weights) for element in indices)


# When the workers have finished, return a TriangularMatrix object
Expand Down

0 comments on commit ebda515

Please sign in to comment.