#endif
#ifdef DEAL_II_WITH_PETSC
-# ifdef DEAL_II_WITH_MPI
# include <petscsys.h>
# include <deal.II/lac/petsc_block_vector.h>
# include <deal.II/lac/petsc_parallel_block_vector.h>
# include <deal.II/lac/petsc_vector.h>
# include <deal.II/lac/petsc_parallel_vector.h>
-# endif
#endif
#ifdef DEAL_II_WITH_SLEPC
namespace MPI
{
#ifdef DEAL_II_WITH_MPI
- // Unfortunately, we have to work around an oddity in the way PETSc and
- // some gcc versions interact. If we use PETSc's MPI dummy implementation,
- // it expands the calls to the two MPI functions basically as ``(n_jobs=1,
- // 0)'', i.e. it assigns the number one to the variable holding the number
- // of jobs, and then uses the comma operator to let the entire expression
- // have the value zero. The latter is important, since ``MPI_Comm_size''
- // returns an error code that we may want to check (we don't here, but one
- // could in principle), and the trick with the comma operator makes sure
- // that both the number of jobs is correctly assigned, and the return
- // value is zero. Unfortunately, if some recent versions of gcc detect
- // that the comma expression just stands by itself, i.e. the result is not
- // assigned to another variable, then they warn ``right-hand operand of
- // comma has no effect''. This unwanted side effect can be suppressed by
- // casting the result of the entire expression to type ``void'' -- not
- // beautiful, but helps calming down unwarranted compiler warnings...
unsigned int n_mpi_processes (const MPI_Comm &mpi_communicator)
{
int n_jobs=1;
"in a program since it initializes the MPI system."));
-
+ int ierr;
#ifdef DEAL_II_WITH_MPI
// if we have PETSc, we will initialize it and let it handle MPI.
// Otherwise, we will do it.
int MPI_has_been_started = 0;
- int ierr = MPI_Initialized(&MPI_has_been_started);
+ ierr = MPI_Initialized(&MPI_has_been_started);
AssertThrowMPI(ierr);
AssertThrow (MPI_has_been_started == 0,
ExcMessage ("MPI error. You can only start MPI once!"));
// make sure the compiler doesn't warn about these variables
(void)argc;
(void)argv;
+ (void)ierr;
#endif
// we are allowed to call MPI_Init ourselves and PETScInitialize will