From 348eb44b6fb63fd4f1b1bfa9d859aee041459ec2 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 29 Jun 2016 18:51:26 +0700 Subject: [PATCH] Make sure fixed source resample is reproducible for MPI runs --- src/simulation.F90 | 2 +- tests/test_fixed_source/results_true.dat | 8 ++++---- tests/test_particle_restart_fixed/results_true.dat | 10 +++++----- .../test_particle_restart_fixed.py | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/simulation.F90 b/src/simulation.F90 index 2e15e7c07..3321dc70f 100644 --- a/src/simulation.F90 +++ b/src/simulation.F90 @@ -275,8 +275,8 @@ contains if (master .and. current_gen /= gen_per_batch) call print_generation() elseif (run_mode == MODE_FIXEDSOURCE) then ! For fixed-source mode, we need to sample the external source - call set_particle_seed(overall_gen*n_particles) do i = 1, work + call set_particle_seed(overall_gen*n_particles + work_index(rank) + i) call sample_external_source(source_bank(i)) end do end if diff --git a/tests/test_fixed_source/results_true.dat b/tests/test_fixed_source/results_true.dat index eece8dc1c..6246dfaf6 100644 --- a/tests/test_fixed_source/results_true.dat +++ b/tests/test_fixed_source/results_true.dat @@ -1,6 +1,6 @@ tally 1: -4.460676E+02 -1.993197E+04 +4.448476E+02 +1.984373E+04 leakage: -9.660000E+00 -9.335800E+00 +9.790000E+00 +9.588300E+00 diff --git a/tests/test_particle_restart_fixed/results_true.dat b/tests/test_particle_restart_fixed/results_true.dat index 9cc800cf6..047760a2d 100644 --- a/tests/test_particle_restart_fixed/results_true.dat +++ b/tests/test_particle_restart_fixed/results_true.dat @@ -1,16 +1,16 @@ current batch: -9.000000E+00 +7.000000E+00 current gen: 1.000000E+00 particle id: -5.900000E+02 +1.440000E+02 run mode: fixed source particle weight: 1.000000E+00 particle energy: -5.284635E+00 +5.749729E+00 particle xyz: -4.995064E+00 7.895146E+00 1.198717E+00 +8.754675E+00 2.551620E+00 4.394350E-01 particle uvw: -7.594252E-01 3.731736E-01 -5.329305E-01 +-5.971721E-01 -4.845709E-01 6.391999E-01 diff --git a/tests/test_particle_restart_fixed/test_particle_restart_fixed.py b/tests/test_particle_restart_fixed/test_particle_restart_fixed.py index fcd377f13..df0398c6e 100644 --- a/tests/test_particle_restart_fixed/test_particle_restart_fixed.py +++ b/tests/test_particle_restart_fixed/test_particle_restart_fixed.py @@ -7,5 +7,5 @@ from testing_harness import ParticleRestartTestHarness if __name__ == '__main__': - harness = ParticleRestartTestHarness('particle_9_590.h5') + harness = ParticleRestartTestHarness('particle_7_144.h5') harness.main()