Skip to content

Commit bdc52f6

Browse files
committed
Merge pull request #175 from memmett/feature/fix174
Make sure number of processors and time steps are consistent.
2 parents c6d6de4 + 69db737 commit bdc52f6

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

examples/advection_diffusion/mpi_pfasst.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ namespace pfasst
7676
pf.set_duration(0.0, nsteps * dt, dt, niters);
7777
pf.set_nsweeps({2, 1});
7878
pf.get_finest<AdvectionDiffusionSweeper<>>()->set_residual_tolerances(abs_residual_tol, 0.0);
79+
pf.set_options();
7980
pf.run();
8081

8182
auto fine = pf.get_finest<AdvectionDiffusionSweeper<>>();
@@ -90,6 +91,9 @@ namespace pfasst
9091
int main(int argc, char** argv)
9192
{
9293
MPI_Init(&argc, &argv);
94+
pfasst::init(argc, argv,
95+
pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper<>::init_opts,
96+
pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper<>::init_logs);
9397
pfasst::examples::advection_diffusion::run_mpi_pfasst(0.0);
9498
fftw_cleanup();
9599
MPI_Finalize();

examples/advection_diffusion/serial_mlsdc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ namespace pfasst
9191
* run mlsdc!
9292
*/
9393
mlsdc.set_duration(0.0, nsteps*dt, dt, niters);
94+
mlsdc.set_options();
9495
mlsdc.run();
9596

9697
fftw_cleanup();

examples/advection_diffusion/serial_mlsdc_autobuild.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ namespace pfasst
8686
auto_build(mlsdc, nodes, build_level);
8787
auto_setup(mlsdc, initial);
8888
mlsdc.set_duration(0.0, nsteps*dt, dt, niters);
89+
mlsdc.set_options();
8990
mlsdc.run();
9091

9192
fftw_cleanup();

src/pfasst/controller/pfasst_impl.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,15 @@ namespace pfasst
4747
int nblocks = int(this->get_end_time() / this->get_time_step()) / comm->size();
4848

4949
if (nblocks == 0) {
50+
CLOG(INFO, "Controller") << "invalid duration: there are more time processors than time steps";
5051
throw ValueError("invalid duration: there are more time processors than time steps");
5152
}
5253

54+
if (nblocks * comm->size() * this->get_time_step() < this->get_end_time()) {
55+
CLOG(INFO, "Controller") << "invalid duration: mismatch between number of time processors and time steps";
56+
throw ValueError("invalid duration: mismatch between number of time processors and time steps");
57+
}
58+
5359
for (int nblock = 0; nblock < nblocks; nblock++) {
5460
this->set_step(nblock * comm->size() + comm->rank());
5561

0 commit comments

Comments
 (0)