Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mark analysis.pca.PCA as not parallelizable #4684

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The rules for this file:
??/??/?? IAlibay, HeetVekariya, marinegor, lilyminium, RMeli,
ljwoods2, aditya292002, pstaerk, PicoCentauri, BFedder,
tyler.je.reddy, SampurnaM, leonwehrhan, kainszs, orionarcher,
yuxuanzhuang, PythonFZ, laksh-krishna-sharma
yuxuanzhuang, PythonFZ, laksh-krishna-sharma, orbeckst

* 2.8.0

Expand Down Expand Up @@ -55,6 +55,7 @@ Fixes
Enhancements
* Introduce parallelization API to `AnalysisBase` and to `analysis.rms.RMSD` class
(Issue #4158, PR #4304)
* explicitly mark `analysis.pca.PCA` as not parallelizable (Issue #4680)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newest first

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know... but may I respectfully disagree here and suggest that we add anything regarding parallelization underneath the parent entry (Issue #4158)? It makes a lot more sense when you read the CHANGELOG.

If it's too confusing to break our convention here, I am happy to switch, of course.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries

* Improve error message for `AtomGroup.unwrap()` when bonds are not present.(Issue #4436, PR #4642)
* Add `analysis.DSSP` module for protein secondary structure assignment, based on [pydssp](https://github.com/ShintaroMinami/PyDSSP)
* Added a tqdm progress bar for `MDAnalysis.analysis.pca.PCA.transform()`
Expand Down
3 changes: 2 additions & 1 deletion package/MDAnalysis/analysis/pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class PCA(AnalysisBase):
generates the principal components of the backbone of the atomgroup and
then transforms those atomgroup coordinates by the direction of those
variances. Please refer to the :ref:`PCA-tutorial` for more detailed
instructions. When using mean selections, the first frame of the selected
instructions. When using mean selections, the first frame of the selected
trajectory slice is used as a reference.

Parameters
Expand Down Expand Up @@ -239,6 +239,7 @@ class PCA(AnalysisBase):
incorrectly handle cases where the ``frame`` argument
was passed.
"""
_analysis_algorithm_is_parallelizable = False

def __init__(self, universe, select='all', align=False, mean=None,
n_components=None, **kwargs):
Expand Down
21 changes: 21 additions & 0 deletions testsuite/MDAnalysisTests/analysis/test_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import numpy as np
import MDAnalysis as mda
from MDAnalysis.analysis import align
import MDAnalysis.analysis.pca
from MDAnalysis.analysis.pca import (PCA, cosine_content,
rmsip, cumulative_overlap)

Expand Down Expand Up @@ -384,3 +385,23 @@ def test_pca_attr_warning(u, attr):
wmsg = f"The `{attr}` attribute was deprecated in MDAnalysis 2.0.0"
with pytest.warns(DeprecationWarning, match=wmsg):
getattr(pca, attr) is pca.results[attr]

@pytest.mark.parametrize(
"classname,is_parallelizable",
[
(MDAnalysis.analysis.pca.PCA, False),
]
)
def test_class_is_parallelizable(classname, is_parallelizable):
assert classname._analysis_algorithm_is_parallelizable == is_parallelizable


@pytest.mark.parametrize(
"classname,backends",
[
(MDAnalysis.analysis.pca.PCA, ('serial',)),
]
)
def test_supported_backends(classname, backends):
assert classname.get_supported_backends() == backends

Loading