Skip to content

Commit a34aa12

Browse files
committed
[coll-comm] disable neighbor comm if open-mpi version < 4.1.0
Signed-off-by: Marcel Koch <[email protected]>
1 parent e04d8e9 commit a34aa12

File tree

7 files changed

+19
-9
lines changed

7 files changed

+19
-9
lines changed

CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ if(GINKGO_BUILD_HWLOC AND (MSVC OR WIN32 OR CYGWIN OR APPLE))
360360
endif()
361361

362362
set(GINKGO_HAVE_GPU_AWARE_MPI OFF)
363-
set(GINKGO_FORCE_SPMV_BLOCKING_COMM OFF)
363+
set(GINKGO_HAVE_OPENMPI_PRE_4_1_X OFF)
364364
if(GINKGO_BUILD_MPI)
365365
find_package(MPI 3.1 COMPONENTS CXX REQUIRED)
366366
if(GINKGO_FORCE_GPU_AWARE_MPI)
@@ -388,13 +388,15 @@ if(GINKGO_BUILD_MPI)
388388
if(NOT valid_openmpi_version)
389389
message(
390390
WARNING
391-
"OpenMPI v4.0.x has a bug that forces us to use blocking communication in our distributed "
391+
"OpenMPI v4.0.x has several bugs that forces us to use non-optimal communication in our distributed "
392392
"matrix class. To enable faster, non-blocking communication, consider updating your OpenMPI version or "
393393
"switch to a different vendor."
394394
)
395-
set(GINKGO_FORCE_SPMV_BLOCKING_COMM ON)
395+
set(GINKGO_HAVE_OPENMPI_PRE_4_1_X ON)
396396
endif()
397+
unset(valid_openmpi_version)
397398
endif()
399+
unset(uses_openmpi)
398400
endif()
399401

400402
# Try to find the third party packages before using our subdirectories

core/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,15 @@ if(GINKGO_BUILD_MPI)
150150
distributed/dense_communicator.cpp
151151
distributed/matrix.cpp
152152
distributed/partition_helpers.cpp
153-
distributed/neighborhood_communicator.cpp
154153
distributed/vector.cpp
155154
distributed/preconditioner/schwarz.cpp
156155
)
156+
if(NOT GINKGO_HAVE_OPENMPI_PRE_4_1_X)
157+
target_sources(
158+
${ginkgo_core}
159+
PRIVATE distributed/neighborhood_communicator.cpp
160+
)
161+
endif()
157162
endif()
158163

159164
# MSVC or CLANG/msys2 with shared: make ginkgo be the major library

core/distributed/dense_communicator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ request DenseCommunicator::i_all_to_all_v(std::shared_ptr<const Executor> exec,
8080
void* recv_buffer,
8181
MPI_Datatype recv_type) const
8282
{
83-
#ifdef GINKGO_FORCE_SPMV_BLOCKING_COMM
83+
#ifdef GINKGO_HAVE_OPENMPI_PRE_4_1_X
8484
comm_.all_to_all_v(exec, send_buffer, send_sizes_.data(),
8585
send_offsets_.data(), send_type, recv_buffer,
8686
recv_sizes_.data(), recv_offsets_.data(), recv_type);

core/distributed/matrix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ mpi::request Matrix<ValueType, LocalIndexType, GlobalIndexType>::communicate(
478478
auto recv_ptr = use_host_buffer ? host_recv_buffer_->get_values()
479479
: recv_buffer_->get_values();
480480
exec->synchronize();
481-
#ifdef GINKGO_FORCE_SPMV_BLOCKING_COMM
481+
#ifdef GINKGO_HAVE_OPENMPI_PRE_4_1_X
482482
comm.all_to_all_v(use_host_buffer ? exec->get_master() : exec, send_ptr,
483483
send_sizes_.data(), send_offsets_.data(), type.get(),
484484
recv_ptr, recv_sizes_.data(), recv_offsets_.data(),
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
ginkgo_create_test(helpers MPI_SIZE 1)
22
ginkgo_create_test(matrix MPI_SIZE 1)
33
ginkgo_create_test(dense_communicator MPI_SIZE 6)
4-
ginkgo_create_test(neighborhood_communicator MPI_SIZE 6)
54
ginkgo_create_test(vector_cache MPI_SIZE 3)
65

6+
if(NOT GINKGO_HAVE_OPENMPI_PRE_4_1_X)
7+
ginkgo_create_test(neighborhood_communicator MPI_SIZE 6)
8+
endif()
9+
710
add_subdirectory(preconditioner)
811
add_subdirectory(solver)

include/ginkgo/config.hpp.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128

129129
/* Do we need to use blocking communication in our SpMV? */
130130
// clang-format off
131-
#cmakedefine GINKGO_FORCE_SPMV_BLOCKING_COMM
131+
#cmakedefine01 GINKGO_HAVE_OPENMPI_PRE_4_1_X
132132
// clang-format on
133133

134134

include/ginkgo/core/distributed/neighborhood_communicator.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <ginkgo/config.hpp>
1010

1111

12-
#if GINKGO_BUILD_MPI
12+
#if GINKGO_BUILD_MPI && !GINKGO_HAVE_OPENMPI_PRE_4_1_X
1313

1414
#include <ginkgo/core/base/mpi.hpp>
1515
#include <ginkgo/core/distributed/collective_communicator.hpp>

0 commit comments

Comments
 (0)