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)
est-driver.scm?id=a6867b2d988a3f0c5cc90e093d8440fe506922e9'>diff
|
Age | Commit message (Expand) | Author |
2021-02-02 | build: Add a --show-duration option to the SCM test-driver....* build-aux/test-driver.scm (script-version): Update.
(show-help): Document it.
(%options): Add the 'show-duration' option.
(test-runner-gnu): Pass as a new argument.
[test-cases-start-time]: New inner variable.
[test-on-test-begin-gnu]: New hook, used to record the start time.
[test-on-test-end-gnu]: Conditionally print elapsed time. Record it as the
optional metadata in the test result file (.trs).
* doc/guix.texi (Running the Test Suite): Document it.
| Maxim Cournoyer |
2021-01-31 | build: test-driver.scm: Allow running as a standalone script....* build-aux/test-driver.scm: Add an exec-based shebang and set the script
executable bit.
(main): Insert a newline after the version string is printed with --version.
| Maxim Cournoyer |
2021-01-31 | build: test-driver.scm: Add a new '--errors-only' option....* build-aux/test-driver.scm (show-help): Add the help text for the
new '--errors-only' option.
(%options): Add the errors-only option.
(test-runner-gnu): Add the errors-only? parameter and update doc. Move the
logging of the test data after the test has completed, so a choice can be made
whether to keep it or discard it based on the value of the test result.
(main): Pass the errors-only? option to the driver.
* doc/guix.texi (Running the Test Suite): Document the new option.
| Maxim Cournoyer |
2021-01-31 | build: test-driver.scm: Add test cases filtering options....* build-aux/test-driver.scm (show-help): Add help text for the new --select
and --exclude options.
(%options): Add the new select and exclude options.
(test-runner-gnu): Pass them to the test runner. Update doc.
(test-match-name*, test-match-name*/negated, %test-match-all): New variables.
(main): Compute the test specifier based on the values of the new options and
apply it to the current test runner when running the test file.
* doc/guix.texi (Running the Test Suite): Document the new options.
| Maxim Cournoyer |
2021-01-31 | build: test-driver.scm: Enable colored test results by default....The Automake parallel test harness does its own smart detection of the
terminal color capability and always provides the --color-tests argument to
the driver. This change defaults the --color-tests argument to true when the
test driver is run on its own (not via Automake).
* build-aux/test-driver.scm (main): Set the default value of the --color-tests
argument to true when it's not explicitly provided.
| Maxim Cournoyer |
2021-01-31 | build: test-driver.scm: Make output redirection optional....This makes it easier (and less surprising) for users to experiment with the
custom Scheme test driver directly. The behavior is unchanged from Automake's
point of view.
* build-aux/test-driver.scm (main): Make the --log-file and --trs-file
arguments optional and update doc. Only open, redirect and close a port to a log file when
the --log-file option is provided. Only open and close a port to a trs file
when the --trs-file option is provided.
(test-runner-gnu): Set OUT-PORT parameter default value to the current output
port. Set the TRS-PORT parameter default value to a void port. Update doc.
| Maxim Cournoyer |