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

Update MPI communicator handling in alien external packages #1666

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
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
16 changes: 0 additions & 16 deletions alien/ArcaneInterface/cmake/LoadAlienTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,6 @@ macro(alien_test)
)
endif ()

if (TARGET arcane_core)

set_tests_properties(${ARGS_BENCH}.${ARGS_NAME} PROPERTIES
ENVIRONMENT "ARCANE_PARALLEL_SERVICE=Mpi"
)

endif ()

if (WIN32)
# ajout de bin/sys_dlls au PATH
set(PATH ${CMAKE_BINARY_DIR}/bin/sys_dlls)
Expand Down Expand Up @@ -121,14 +113,6 @@ macro(alien_test)
)
endif ()

if (TARGET arcane_core)

set_tests_properties(${ARGS_BENCH}.${ARGS_NAME}.mpi-${mpi} PROPERTIES
ENVIRONMENT "ARCANE_PARALLEL_SERVICE=Mpi"
)

endif ()

if (WIN32)
# ajout de bin/sys_dlls au PATH
set(PATH ${CMAKE_BINARY_DIR}/bin/sys_dlls)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ HypreMatrix::initMatrix(const int ilower, const int iupper, const int jlower,
m_internal = new MatrixInternal(static_cast<MPI_Comm>(pm), memory_type, exec_space);
}
else {
alien_fatal([&] {
cout() << "Mpi is not initialized. Should be the case even in sequential";
});
m_internal = new MatrixInternal(MPI_COMM_WORLD,
memory_type,
exec_space);
}
return m_internal->init(ilower, iupper, jlower, jupper, lineSizes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ HypreVector::allocate()
new VectorInternal(static_cast<const MPI_Comm>(pm), memory_type, exec_space);
}
else {
alien_fatal([&] {
cout() << "Mpi is not initialized. Should be the case even in sequential";
});
m_internal = new VectorInternal(MPI_COMM_WORLD,
memory_type,
exec_space);
}
int ilower = dist.offset() * m_block_size;
int iupper = ilower + dist.localSize() * m_block_size - 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,9 @@ HypreInternalLinearSolver::solve(
int (*precond_destroy_function)(HYPRE_Solver) = NULL;

auto pm = A.getParallelMng()->communicator();
if (!pm.isValid()) alien_fatal([&] {
cout() << "Mpi is not initialized. Should be the case even in sequential";
});
MPI_Comm comm = static_cast<const MPI_Comm>(pm);
MPI_Comm comm = (pm.isValid())
? static_cast<const MPI_Comm>(pm)
: MPI_COMM_WORLD;
std::string precond_name = "undefined";
switch (m_options->preconditioner()) {
case HypreOptionTypes::NoPC:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <arccore/base/NotImplementedException.h>
#include <arccore/collections/Array2.h>
#include <arccore/message_passing_mpi/MpiMessagePassingMng.h>
#include <arccore/message_passing/Communicator.h>
#include <arccore/trace/ITraceMng.h>

#include <fstream>
Expand Down Expand Up @@ -68,18 +69,12 @@ class AsciiDumper::Internal
throw Arccore::FatalErrorException("dist parallel mng ptr is nullptr");
std::cout << dist.isParallel() << std::endl;
std::cout << dist.parallelMng() << std::endl;
auto* parallel_mng =
dynamic_cast<Arccore::MessagePassing::Mpi::MpiMessagePassingMng*>(
dist.parallelMng());
if (parallel_mng == nullptr)
throw Arccore::FatalErrorException(
"parallel mng ptr is nullptr : not a MpiMessagePassingMng impl");
const MPI_Comm* arcane_mpi_comm = parallel_mng->getMPIComm();
if (arcane_mpi_comm == 0) {
auto arcane_mpi_comm = dist.parallelMng()->communicator();
if (arcane_mpi_comm.isValid()) {
PetscViewerASCIIOpen(arcane_mpi_comm, filename.localstr(), &viewer);
}
else {
PetscViewerASCIIOpen(PETSC_COMM_SELF, filename.localstr(), &viewer);
} else {
const MPI_Comm* comm = arcane_mpi_comm;
PetscViewerASCIIOpen(*comm, filename.localstr(), &viewer);
}
_pushFormat(viewer, style);
}
Expand Down
3 changes: 0 additions & 3 deletions alien/ArcaneInterface/test/AlienBench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ alien_test(
WORKING_DIRECTORY ${ALIEN_ARCANE_INTERFACE_DIR}/test/AlienBench)

if (TARGET petsc)
set(ENV (ARCANE_PARALLEL_SERVICE) "Mpi")

alien_test(
BENCH alien.bench
Expand Down Expand Up @@ -290,7 +289,6 @@ if (TARGET petsc)
endif ()

if (TARGET hypre)
set(ENV (ARCANE_PARALLEL_SERVICE) "Mpi")

alien_test(
BENCH alien.bench.hypre
Expand Down Expand Up @@ -347,7 +345,6 @@ endif(ALIEN_USE_SYCL)
endif ()

if (TARGET trilinos)
set(ENV (ARCANE_PARALLEL_SERVICE) "Mpi")

alien_test(
BENCH alien.bench.trilinos
Expand Down
Loading