Skip to content

Commit dc9654e

Browse files
orbeckstyuxuanzhuang
authored andcommitted
mark analysis.pca.PCA as not parallelizable (MDAnalysis#4684)
- fix MDAnalysis#4680 - PCA explicitly marked as not parallelizable (at least not with simple split-apply-combine) - add tests - update CHANGELOG
1 parent acc60b8 commit dc9654e

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

package/CHANGELOG

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The rules for this file:
1717
??/??/?? IAlibay, HeetVekariya, marinegor, lilyminium, RMeli,
1818
ljwoods2, aditya292002, pstaerk, PicoCentauri, BFedder,
1919
tyler.je.reddy, SampurnaM, leonwehrhan, kainszs, orionarcher,
20-
yuxuanzhuang, PythonFZ, laksh-krishna-sharma
20+
yuxuanzhuang, PythonFZ, laksh-krishna-sharma, orbeckst
2121

2222
* 2.8.0
2323

@@ -55,6 +55,7 @@ Fixes
5555
Enhancements
5656
* Introduce parallelization API to `AnalysisBase` and to `analysis.rms.RMSD` class
5757
(Issue #4158, PR #4304)
58+
* explicitly mark `analysis.pca.PCA` as not parallelizable (Issue #4680)
5859
* Improve error message for `AtomGroup.unwrap()` when bonds are not present.(Issue #4436, PR #4642)
5960
* Add `analysis.DSSP` module for protein secondary structure assignment, based on [pydssp](https://github.com/ShintaroMinami/PyDSSP)
6061
* Added a tqdm progress bar for `MDAnalysis.analysis.pca.PCA.transform()`

package/MDAnalysis/analysis/pca.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class PCA(AnalysisBase):
143143
generates the principal components of the backbone of the atomgroup and
144144
then transforms those atomgroup coordinates by the direction of those
145145
variances. Please refer to the :ref:`PCA-tutorial` for more detailed
146-
instructions. When using mean selections, the first frame of the selected
146+
instructions. When using mean selections, the first frame of the selected
147147
trajectory slice is used as a reference.
148148
149149
Parameters
@@ -239,6 +239,7 @@ class PCA(AnalysisBase):
239239
incorrectly handle cases where the ``frame`` argument
240240
was passed.
241241
"""
242+
_analysis_algorithm_is_parallelizable = False
242243

243244
def __init__(self, universe, select='all', align=False, mean=None,
244245
n_components=None, **kwargs):

testsuite/MDAnalysisTests/analysis/test_pca.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import numpy as np
2424
import MDAnalysis as mda
2525
from MDAnalysis.analysis import align
26+
import MDAnalysis.analysis.pca
2627
from MDAnalysis.analysis.pca import (PCA, cosine_content,
2728
rmsip, cumulative_overlap)
2829

@@ -384,3 +385,23 @@ def test_pca_attr_warning(u, attr):
384385
wmsg = f"The `{attr}` attribute was deprecated in MDAnalysis 2.0.0"
385386
with pytest.warns(DeprecationWarning, match=wmsg):
386387
getattr(pca, attr) is pca.results[attr]
388+
389+
@pytest.mark.parametrize(
390+
"classname,is_parallelizable",
391+
[
392+
(MDAnalysis.analysis.pca.PCA, False),
393+
]
394+
)
395+
def test_class_is_parallelizable(classname, is_parallelizable):
396+
assert classname._analysis_algorithm_is_parallelizable == is_parallelizable
397+
398+
399+
@pytest.mark.parametrize(
400+
"classname,backends",
401+
[
402+
(MDAnalysis.analysis.pca.PCA, ('serial',)),
403+
]
404+
)
405+
def test_supported_backends(classname, backends):
406+
assert classname.get_supported_backends() == backends
407+

0 commit comments

Comments
 (0)