Skip to content

Commit 3c11df2

Browse files
committed
mpi: re-require the user to call MPI_Init
1 parent d614339 commit 3c11df2

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

examples/advection_diffusion/mpi_pfasst.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ namespace pfasst
8989
#ifndef PFASST_UNIT_TESTING
9090
int main(int argc, char** argv)
9191
{
92+
MPI_Init(&argc, &argv);
9293
pfasst::init(argc, argv,
9394
pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper<>::init_opts,
94-
pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper<>::init_logs,
95-
true);
95+
pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper<>::init_logs);
9696
pfasst::examples::advection_diffusion::run_mpi_pfasst(0.0);
9797
fftw_cleanup();
9898
MPI_Finalize();

include/pfasst.hpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,17 @@ using namespace std;
77
#include "pfasst/config.hpp"
88
#include "pfasst/logging.hpp"
99

10-
#ifdef WITH_MPI
11-
#include <mpi.h>
12-
#endif
13-
1410

1511
namespace pfasst
1612
{
1713
inline static void init(int argc, char** argv,
1814
std::function<void()> opts = nullptr,
19-
std::function<void()> logs = nullptr,
20-
bool with_mpi = false)
15+
std::function<void()> logs = nullptr)
2116
{
2217
if (opts) {
2318
opts();
2419
}
2520
config::init();
26-
if (with_mpi) {
27-
#ifdef WITH_MPI
28-
MPI_Init(&argc, &argv);
29-
#else
30-
cerr << "PFASST::init() : 'with_mpi' flag used without enabling MPI" << endl;
31-
#endif
32-
}
3321
config::read_commandline(argc, argv);
3422
log::start_log(argc, argv);
3523
if (logs) {

0 commit comments

Comments
 (0)