@@ -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 )
0 commit comments