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

Parallelization for AdjMatrices #1159

Draft
wants to merge 1 commit into
base: derivatives-from-backpropegation
Choose a base branch
from

Conversation

Iximiel
Copy link
Member

@Iximiel Iximiel commented Nov 26, 2024

@gtribello I'm starting to see if I can see a way to make AdjacencyMatrixBase paralelizable on devices that are not omp+mpi.

I just started to read the methods and as usual. And as usual, I think that the bookkeeping and the memory organization should be made before entering the parallel region.

}

void AdjacencyMatrixBase::performTask( const std::string& controller, const unsigned& index1, const unsigned& index2, MultiValue& myvals ) const {
Vector zero; zero.zero(); plumed_dbg_assert( index2<myvals.getAtomVector().size() );
Vector zero; zero.zero();
plumed_dbg_assert( index2<myvals.getAtomVector().size() );
double weight = calculateWeight( zero, myvals.getAtomVector()[index2], myvals.getNumberOfIndices()-myvals.getSplitIndex(), myvals );
Copy link
Member Author

Choose a reason for hiding this comment

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

@gtribello
Since I do not know all the details, I have a question on calculateWeight: by git-grepping this is only called here.

And so the first argument is a fixed {0.0,0.0,0.0}, and it is only used in HBPammMatrix TopologyMatrix to do something like "pos2-0".
My suggestion is to change the signature to something like double calculateWeight(Vector , unsigned , MultiValue& ) so there is no need to copy the already calculated distance in a temporary value, moreover the signature can be that, but in the definition, you can freely add const to variables passed by value.

I am basing this suggestion also on this)

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I think if you don't pass the first argument, it would be fine. The pbc are all applied in one place because Michele Ceriotti wrote a fast algorithm to do pbc distance on many arguments at the same time, which is used here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants