From: Stefano Zampini Date: Sun, 22 Jan 2023 12:40:41 +0000 (+0300) Subject: Fix sundials test X-Git-Tag: v9.5.0-rc1~621^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6702c6d6d7b2bde242f54d273c0f9cace9fe9f59;p=dealii.git Fix sundials test --- diff --git a/tests/sundials/n_vector.cc b/tests/sundials/n_vector.cc index a23fbcba81..2c18911145 100644 --- a/tests/sundials/n_vector.cc +++ b/tests/sundials/n_vector.cc @@ -29,6 +29,10 @@ #include "../../include/deal.II/sundials/n_vector.templates.h" #include +#ifdef DEAL_II_WITH_MPI +# include +#endif + #include "../tests.h" using namespace SUNDIALS::internal; @@ -371,9 +375,16 @@ test_get_communicator() global_nvector_context #endif ); - Assert(*static_cast(N_VGetCommunicator(n_vector)) == - MPI_COMM_WORLD, - NVectorTestError()); + // PETSc duplicates the user communicator. It does not make sense to + // compare MPI_Comm using "==", which is equivalent to MPI_IDENT. + // MPI_CONGRUENT indicates same group but different context (e.g. tags, + // keyvals, etc.) +#ifdef DEAL_II_WITH_MPI + int result; + auto comm = static_cast(N_VGetCommunicator(n_vector)); + MPI_Comm_compare(*comm, MPI_COMM_WORLD, &result); + Assert(result == MPI_IDENT || result == MPI_CONGRUENT, NVectorTestError()); +#endif deallog << "test_get_communicator OK" << std::endl; }