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

Use MPI_Comm_dup to separate ArborX comm context from user's #135

Merged
merged 2 commits into from
Oct 9, 2019
Merged
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
9 changes: 7 additions & 2 deletions src/ArborX_DistributedSearchTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class DistributedSearchTree
template <typename Primitives>
DistributedSearchTree(MPI_Comm comm, Primitives const &primitives);

~DistributedSearchTree() { MPI_Comm_free(&_comm); }

/** Returns the smallest axis-aligned box able to contain all the objects
* stored in the tree or an invalid box if the tree is empty.
*/
Expand Down Expand Up @@ -105,9 +107,12 @@ template <typename DeviceType>
template <typename Primitives>
DistributedSearchTree<DeviceType>::DistributedSearchTree(
MPI_Comm comm, Primitives const &primitives)
: _comm(comm)
, _bottom_tree(primitives)
: _bottom_tree(primitives)
{
// Create new context for the library to isolate library's communication from
// user's
MPI_Comm_dup(comm, &_comm);
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to comment about the duplication. I do not understand what is different from copying since it duplicate the attributes of the original communicator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copying communicator does not create new context. Duplicating does. Having a different context means that the messages sent by user cannot be received by the library and vice versa, even if they have the exact same information and tags.

Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment in the code.


int comm_rank;
MPI_Comm_rank(_comm, &comm_rank);
int comm_size;
Expand Down