-
Notifications
You must be signed in to change notification settings - Fork 845
Add ASV benchmarks for MDAnalysis.lib core kernels #5292
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
Open
Amarendra22
wants to merge
2
commits into
MDAnalysis:develop
Choose a base branch
from
Amarendra22:benchmark-lib
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import MDAnalysis as mda | ||
| from MDAnalysis.analysis import contacts | ||
| from MDAnalysisTests.datafiles import PSF, DCD | ||
|
|
||
|
|
||
| class ContactsBench: | ||
|
|
||
| params = [4.5, 6.0] | ||
| param_names = ["radius"] | ||
|
|
||
| def setup(self, radius): | ||
| self.u = mda.Universe(PSF, DCD) | ||
| self.sel1 = "protein" | ||
| self.sel2 = "name CA" | ||
|
|
||
| g1 = self.u.select_atoms(self.sel1) | ||
| g2 = self.u.select_atoms(self.sel2) | ||
|
|
||
| self.analysis = contacts.Contacts( | ||
| self.u, | ||
| select=(self.sel1, self.sel2), | ||
| refgroup=(g1, g2), | ||
| radius=radius, | ||
| ) | ||
|
|
||
| def time_contacts_run(self, radius): | ||
| self.analysis.run() |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file may not be needed. Remove it and see it it still works. |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import numpy as np | ||
| from MDAnalysis.lib.distances import calc_dihedrals | ||
|
|
||
|
|
||
| class DihedralBench: | ||
|
|
||
| params = [100, 500, 1000, 10000] | ||
| param_names = ["n_dihedrals"] | ||
|
|
||
| def setup(self, n_dihedrals): | ||
| self.coords = np.random.random((n_dihedrals, 4, 3)) | ||
|
|
||
| def time_calc_dihedrals(self, n_dihedrals): | ||
| calc_dihedrals( | ||
| self.coords[:,0], | ||
| self.coords[:,1], | ||
| self.coords[:,2], | ||
| self.coords[:,3] | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import numpy as np | ||
| from MDAnalysis.lib.distances import distance_array, self_distance_array | ||
|
|
||
|
|
||
| class DistanceArrayBench: | ||
|
|
||
| params = [100, 500, 1000, 10000] | ||
| param_names = ["n_atoms"] | ||
|
|
||
| def setup(self, n_atoms): | ||
| self.coords1 = np.random.random((n_atoms, 3)) | ||
| self.coords2 = np.random.random((n_atoms, 3)) | ||
|
|
||
| def time_distance_array(self, n_atoms): | ||
| distance_array(self.coords1, self.coords2) | ||
|
|
||
| class SelfDistanceArrayBench: | ||
|
|
||
| params = [100, 500, 1000, 10000] | ||
| param_names = ["n_atoms"] | ||
|
|
||
| def setup(self, n_atoms): | ||
| self.coords = np.random.random((n_atoms, 3)) | ||
|
|
||
| def time_self_distance_array(self, n_atoms): | ||
| self_distance_array(self.coords) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import numpy as np | ||
| from MDAnalysis.lib.nsgrid import FastNS | ||
|
|
||
|
|
||
| class FastNSBench: | ||
|
|
||
| params = [100, 500, 1000, 10000] | ||
| param_names = ["n_atoms"] | ||
|
|
||
| def setup(self, n_atoms): | ||
| self.coords = np.random.random((n_atoms, 3)).astype(np.float32) | ||
| self.box = np.array([10, 10, 10, 90, 90, 90], dtype=np.float32) | ||
|
|
||
| def time_fastns(self, n_atoms): | ||
| ns = FastNS(5.0, self.coords, self.box) | ||
| ns.self_search() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import numpy as np | ||
| from MDAnalysis.lib.NeighborSearch import AtomNeighborSearch | ||
| import MDAnalysis as mda | ||
| from MDAnalysisTests.datafiles import PSF, DCD | ||
|
|
||
|
|
||
| class NeighborSearchBench: | ||
|
|
||
| def setup(self): | ||
| self.u = mda.Universe(PSF, DCD) | ||
| self.atoms = self.u.select_atoms("protein") | ||
| self.ns = AtomNeighborSearch(self.atoms) | ||
|
|
||
| def time_neighbor_search(self): | ||
| self.ns.search(self.atoms, 5.0) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already a contacts benchmark in develop. Remove this one here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also automatically resolve the merge conflict that is indicated in the GitHub status checks box.