Ensure MPI is initialized before getting rank, which may be called early by
Logger::write() via dolfin::info().
Fixes "MPI_Comm_rank called before MPI_INIT" error from
`demo_stokes-iterative_serial` and `demo_waveguide_serial` tests.
Submitted upstream at https://bitbucket.org/fenics-project/dolfin/issues/1127
--- a/dolfin/common/MPI.cpp
+++ b/dolfin/common/MPI.cpp
@@ -143,6 +143,7 @@ MPI_Info& dolfin::MPIInfo::operator*()
unsigned int dolfin::MPI::rank(const MPI_Comm comm)
{
#ifdef HAS_MPI
+ SubSystemsManager::init_mpi();
int rank;
MPI_Comm_rank(comm, &rank);
return rank;
diff --git a/dolfin/common/MPI.h b/dolfin/common/MPI.h
index b93f6df30..854114a3f 100644
--- a/dolfin/common/MPI.h
+++ b/dolfin/common/MPI.h
@@ -102,12 +102,13 @@ namespace dolfin
/// communicator
void reset(MPI_Comm comm);
- /// Return process rank for the communicator
+ /// Return process rank for the communicator. This function will
+ /// also initialize MPI if it hasn't already been initialised.
unsigned int rank() const;
/// Return size of the group (number of processes) associated
- /// with the communicator. This function will also intialise MPI
- /// if it hasn't already been intialised.
+ /// with the communicator. This function will also initialise MPI
+ /// if it hasn't already been initialised.
unsigned int size() const;
/// Set a barrier (synchronization point)
guix-time-machine.sh?id=2d11361a972f2835eaeeadff8f5215d193edfb7a'>diff
|
Age | Commit message (Expand) | Author |
2024-03-11 | time-machine: Allow time travels to v0.16.0....* guix/scripts/time-machine.scm (%oldest-possible-commit): Change to
v0.16.0.
* tests/guix-time-machine.sh: Adjust comment.
Change-Id: I9ad82bd45fee0d172b5348a8ae16e990338a3a97
| Ludovic Courtès |
2023-11-05 | tests: Make ‘guix time-machine’ test effective....The test as added in 79ec651a286c71a3d4c72be33a1f80e76a560031 had no
effect: first because ‘guix time-machine --commit=X’, not followed by a
command, does nothing, and second because the “! COMMAND” shell stanza
does not have the desired effect (see <https://issues.guix.gnu.org/62406>).
This change rewrites the test to make it effective.
* tests/guix-time-machine.sh: Rewrite.
Change-Id: Ib44a11331c8625e346139a236cffa699cdbd02f2
| Ludovic Courtès |
2023-08-16 | scripts: time-machine: Error when attempting to visit too old commits....* doc/guix.texi (Invoking guix time-machine): Document limitation.
* guix/inferior.scm (cached-channel-instance): New VALIDATE-CHANNELS
argument. Use it to validate channels when there are no cache hit.
* guix/scripts/time-machine.scm
(%options): Tag the given reference with 'tag-or-commit instead of 'commit.
(%oldest-possible-commit): New variable.
(guix-time-machine) <validate-guix-channel>: New nested procedure. Pass it to
the 'cached-channel-instance' call.
* tests/guix-time-machine.sh: New test.
* Makefile.am (SH_TESTS): Register it.
Suggested-by: Simon Tournier <zimon.toutoune@gmail.com>
Reviewed-by: Ludovic Courtès <ludo@gnu.org>
Reviewed-by: Simon Tournier <zimon.toutoune@gmail.com>
| Maxim Cournoyer |