-
Notifications
You must be signed in to change notification settings - Fork 90
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
Add specific communicator for neighborhood communication #1588
base: index-map-pgm
Are you sure you want to change the base?
Conversation
6acf7c4
to
8aa6ab9
Compare
b42ab92
to
8f104fd
Compare
8aa6ab9
to
77398bd
Compare
77398bd
to
d278cad
Compare
8f104fd
to
a0824a8
Compare
d278cad
to
d6112ef
Compare
a0824a8
to
8ad3f2f
Compare
d6112ef
to
1582673
Compare
1582673
to
db9b48a
Compare
8ad3f2f
to
26678b3
Compare
db9b48a
to
72eafff
Compare
26678b3
to
006d67d
Compare
72eafff
to
3c70106
Compare
006d67d
to
b295b11
Compare
3c70106
to
a1567b8
Compare
1f49b91
to
4db050c
Compare
3ad5eee
to
6395054
Compare
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.
First pass, mostly interface and implementation
- What is the moved-from state of a Communicator? Should it match that of an MPI communicator wrapper, and be MPI_NULL, or preserve the MPI communicator?
@upsj I think the moved-from that should be using |
4db050c
to
1ebe59f
Compare
604a6e9
to
ba0982e
Compare
1ebe59f
to
e7d32a1
Compare
#cmakedefine GINKGO_FORCE_SPMV_BLOCKING_COMM | ||
#cmakedefine01 GINKGO_HAVE_OPENMPI_PRE_4_1_X |
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.
public interface break?
but I might also consider it is under experimental feature
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.
I can add the old macro again, but I'm not really sure how we usually consider macros for interface stability. IMO we either should state which macros are public, and which are private. Because this macro should definitely be private.
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.
some of them I might consider it is public like version and propabably mixed precision.
This is only used in the experimental feature, so I also think it is free to change
} // namespace gko | ||
|
||
#endif |
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.
} // namespace gko | |
#endif | |
} // namespace gko | |
#endif |
* Default constructor with empty communication pattern | ||
* @param base the base communicator |
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.
* Default constructor with empty communication pattern | |
* @param base the base communicator | |
* Default constructor with empty communication pattern | |
* | |
* @param base the base communicator |
* @tparam RecvType the type of the elements to receive | ||
* @param exec the executor for the communication |
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.
* @tparam RecvType the type of the elements to receive | |
* @param exec the executor for the communication | |
* @tparam RecvType the type of the elements to receive | |
* | |
* @param exec the executor for the communication |
* Default constructor with empty communication pattern | ||
* @param base the base communicator |
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.
* Default constructor with empty communication pattern | |
* @param base the base communicator | |
* Default constructor with empty communication pattern | |
* | |
* @param base the base communicator |
* @tparam GlobalIndexType the global index type of the map | ||
* @param base the base communicator |
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.
* @tparam GlobalIndexType the global index type of the map | |
* @param base the base communicator | |
* @tparam GlobalIndexType the global index type of the map | |
* | |
* @param base the base communicator |
* Equality is defined as having identical or congruent communicators and | ||
* their communication pattern is equal. No communication is done, i.e. | ||
* there is no reduction over the local equality check results. |
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.
* Equality is defined as having identical or congruent communicators and | |
* their communication pattern is equal. No communication is done, i.e. | |
* there is no reduction over the local equality check results. | |
* Equality is defined as having identical or congruent communicators and | |
* their communication pattern is equal. There is no communication need in this function, i.e. | |
* there is no reduction over the local equality check results. |
ba0982e
to
23b4fe7
Compare
1216932
to
ceb6f2e
Compare
Co-authored-by: Pratik Nayak <[email protected]>
Co-authored-by: Pratik Nayak <[email protected]>
- fix include guards - update docs - implement copy/move constructors/assignment with tests - add equality test for collective communicators (needed for testing) - always enable neighborhood comm, just throw if openmpi is too old - define moved-from state as MPI_COMM_NULL + empty sizes/offsets - remove unnecessary namespace - make virtual function protected Co-authored-by: Pratik Nayak <[email protected]> Co-authored-by: Tobias Ribizel <[email protected]>
- documentation - formatting Co-authored-by: Yu-Hsiang M. Tsai <[email protected]> Signed-off-by: Marcel Koch <[email protected]>
ceb6f2e
to
807118c
Compare
- merge tests Co-authored-by: Yu-Hsiang M. Tsai <[email protected]>
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.
LGTM in general.
* This implementation uses the neighborhood communication | ||
* MPI_Ineighbor_alltoallv. See MPI documentation for more details. |
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.
wrong one
* @param recv_buffer the receive buffer | ||
* @return a request handle |
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.
* @param recv_buffer the receive buffer | |
* @return a request handle | |
* @param recv_buffer the receive buffer | |
* | |
* @return a request handle |
std::partial_sum(send_sizes_.begin(), send_sizes_.end(), | ||
send_offsets_.begin() + 1); | ||
std::partial_sum(recv_sizes_.begin(), recv_sizes_.end(), | ||
recv_offsets_.begin() + 1); |
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.
Could you remind me this behavior?
the constructor with the default value T() is until c++11, but the others will rely on the allocator, which gives the uninitialized storage?
* The send_buffer must have allocated at least get_send_size number of | ||
* elements, and the recv_buffer must have allocated at least get_recv_size | ||
* number of elements. |
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.
it only accepts the plain pointer.
Should we use the gko::array to ensure the size fulfill the requirement?
ASSERT_TRUE(moved == spcomm); | ||
ASSERT_TRUE(moved_from == empty_comm); |
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.
ASSERT_TRUE(moved == spcomm); | |
ASSERT_TRUE(moved_from == empty_comm); | |
ASSERT_EQ(moved, spcomm); | |
ASSERT_EQ(moved_from, empty_comm); |
ASSERT_TRUE(moved == spcomm); | ||
ASSERT_TRUE(moved_from == empty_comm); |
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.
ASSERT_TRUE(moved == spcomm); | |
ASSERT_TRUE(moved_from == empty_comm); | |
ASSERT_EQ(moved, spcomm); | |
ASSERT_EQ(moved_from, empty_comm); |
using communicator_type = typename TestFixture::communicator_type; | ||
using part_type = typename TestFixture::part_type; | ||
using map_type = typename TestFixture::map_type; | ||
auto part = gko::share(part_type::build_from_global_size_uniform( |
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.
use create_default_comm()
?
using communicator_type = typename TestFixture::communicator_type; | ||
using part_type = typename TestFixture::part_type; | ||
using map_type = typename TestFixture::map_type; | ||
auto part = gko::share(part_type::build_from_global_size_uniform( |
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.
use create_default_comm()
?
|
||
auto req = spcomm.i_all_to_all_v(this->ref, static_cast<int*>(nullptr), | ||
static_cast<int*>(nullptr)); | ||
req.wait(); |
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.
req.wait(); | |
ASSERT_NO_THROW(req.wait()); |
maybe?
This PR adds a communicator that only handles neighborhood all-to-all communication. It implements the new interface
collective_communicator
, which provides different implementations for a selected set of collective mpi routines. Currently, this only includes the non-blocking all-to-all.The communication uses a fixed pattern, i.e. the send/recv sizes are fixed when the neighborhood communicator is constructed. I would have liked to decouple that, but this would require some knowledge of how the sizes are stored at the interface level. If someone has an idea for that, please let me know.
This is the first part of splitting up #1546.
The neighborhood all-to-all has a bug in OpenMPI < v4.1.0, which makes it necessary to disable the neighborhood communicator in this case. As replacement, there is also a dense all-to-all communicator.
Todo:
PR Stack: