Skip to content

Commit 10388b6

Browse files
Firedrake ensemble fix (#528)
* Fix for Firedrake ensemble communicator * Problem seems to be in Gusto logging. Bit sus... * Removed debug output from tutorial while being at it * Added space-time-parallelism to Gusto tests * Forgot linting..
1 parent c13d5a5 commit 10388b6

File tree

4 files changed

+24
-7
lines changed

4 files changed

+24
-7
lines changed

.github/workflows/ci_pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ jobs:
205205
firedrake-clean
206206
cd ./pySDC
207207
coverage run -m pytest --continue-on-collection-errors -v --durations=0 /repositories/pySDC/pySDC/tests -m firedrake
208-
timeout-minutes: 120
208+
timeout-minutes: 45
209209
- name: Make coverage report
210210
run: |
211211
. /home/firedrake/firedrake/bin/activate

pySDC/helpers/firedrake_ensemble_communicator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ def Isend(self, buf, dest, tag=MPI.ANY_TAG):
6767
return self.ensemble.ensemble_comm.Isend(buf=buf, dest=dest, tag=tag)
6868
return self.ensemble.isend(buf, dest, tag=tag)[0]
6969

70+
def Free(self):
71+
del self
72+
7073

7174
def get_ensemble(comm, space_size):
7275
return fd.Ensemble(comm, space_size)

pySDC/tests/test_helpers/test_gusto_coupling.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ def tracer_setup(tmpdir='./tmp', degree=1, small_dt=False, comm=None):
2626
COMM_WORLD,
2727
)
2828
from gusto import OutputParameters, Domain, IO
29+
from gusto.core.logging import logger, INFO
2930
from collections import namedtuple
3031

32+
logger.setLevel(INFO)
33+
3134
opts = ('domain', 'tmax', 'io', 'f_init', 'f_end', 'degree', 'uexpr', 'umax', 'radius', 'tol')
3235
TracerSetup = namedtuple('TracerSetup', opts)
3336
TracerSetup.__new__.__defaults__ = (None,) * len(opts)
@@ -620,15 +623,17 @@ def test_pySDC_integrator_with_adaptivity(dt_initial, setup):
620623
@pytest.mark.firedrake
621624
@pytest.mark.parametrize('n_steps', [1, 2, 4])
622625
@pytest.mark.parametrize('useMPIController', [True, False])
623-
def test_pySDC_integrator_MSSDC(n_steps, useMPIController, setup, submit=True):
626+
def test_pySDC_integrator_MSSDC(n_steps, useMPIController, setup, submit=True, n_tasks=4):
624627
if submit and useMPIController:
625628
import os
626629
import subprocess
627630

631+
assert n_steps <= n_tasks
632+
628633
my_env = os.environ.copy()
629634
my_env['COVERAGE_PROCESS_START'] = 'pyproject.toml'
630635
cwd = '.'
631-
cmd = f'mpiexec -np {n_steps} python {__file__} --test=MSSDC'.split()
636+
cmd = f'mpiexec -np {n_tasks} python {__file__} --test=MSSDC --n_steps={n_steps}'.split()
632637

633638
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=my_env, cwd=cwd)
634639
p.wait()
@@ -653,7 +658,7 @@ def test_pySDC_integrator_MSSDC(n_steps, useMPIController, setup, submit=True):
653658
if useMPIController:
654659
from pySDC.helpers.firedrake_ensemble_communicator import FiredrakeEnsembleCommunicator
655660

656-
controller_communicator = FiredrakeEnsembleCommunicator(COMM_WORLD, 1)
661+
controller_communicator = FiredrakeEnsembleCommunicator(COMM_WORLD, COMM_WORLD.size // n_steps)
657662
assert controller_communicator.size == n_steps
658663
MSSDC_args = {'useMPIController': True, 'controller_communicator': controller_communicator}
659664
dirname = f'./tmp_{controller_communicator.rank}'
@@ -777,13 +782,19 @@ def test_pySDC_integrator_MSSDC(n_steps, useMPIController, setup, submit=True):
777782
type=str,
778783
default=None,
779784
)
785+
parser.add_argument(
786+
'--n_steps',
787+
help="number of steps",
788+
type=int,
789+
default=None,
790+
)
780791
args = parser.parse_args()
781792

782793
if args.test == 'MSSDC':
783-
test_pySDC_integrator_MSSDC(n_steps=MPI.COMM_WORLD.size, useMPIController=True, setup=setup, submit=False)
794+
test_pySDC_integrator_MSSDC(n_steps=args.n_steps, useMPIController=True, setup=setup, submit=False)
784795
else:
785796
# test_generic_gusto_problem(setup)
786797
# test_pySDC_integrator_RK(False, RK4, setup)
787798
# test_pySDC_integrator(False, False, setup)
788-
test_pySDC_integrator_with_adaptivity(1e-3, setup)
789-
# test_pySDC_integrator_MSSDC(2, False, setup)
799+
# test_pySDC_integrator_with_adaptivity(1e-3, setup)
800+
test_pySDC_integrator_MSSDC(4, True, setup)

pySDC/tutorial/step_7/F_pySDC_with_Gusto.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
from pySDC.helpers.firedrake_ensemble_communicator import FiredrakeEnsembleCommunicator
3030
from gusto import SDC, BackwardEuler
3131
from gusto.core.labels import implicit, time_derivative
32+
from gusto.core.logging import logger, INFO
33+
34+
logger.setLevel(INFO)
3235

3336

3437
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter

0 commit comments

Comments
 (0)