@@ -623,15 +623,17 @@ def test_pySDC_integrator_with_adaptivity(dt_initial, setup):
623623@pytest .mark .firedrake
624624@pytest .mark .parametrize ('n_steps' , [1 , 2 , 4 ])
625625@pytest .mark .parametrize ('useMPIController' , [True , False ])
626- 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 ):
627627 if submit and useMPIController :
628628 import os
629629 import subprocess
630630
631+ assert n_steps <= n_tasks
632+
631633 my_env = os .environ .copy ()
632634 my_env ['COVERAGE_PROCESS_START' ] = 'pyproject.toml'
633635 cwd = '.'
634- 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 ()
635637
636638 p = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , env = my_env , cwd = cwd )
637639 p .wait ()
@@ -656,7 +658,7 @@ def test_pySDC_integrator_MSSDC(n_steps, useMPIController, setup, submit=True):
656658 if useMPIController :
657659 from pySDC .helpers .firedrake_ensemble_communicator import FiredrakeEnsembleCommunicator
658660
659- controller_communicator = FiredrakeEnsembleCommunicator (COMM_WORLD , 1 )
661+ controller_communicator = FiredrakeEnsembleCommunicator (COMM_WORLD , COMM_WORLD . size // n_steps )
660662 assert controller_communicator .size == n_steps
661663 MSSDC_args = {'useMPIController' : True , 'controller_communicator' : controller_communicator }
662664 dirname = f'./tmp_{ controller_communicator .rank } '
@@ -780,10 +782,16 @@ def test_pySDC_integrator_MSSDC(n_steps, useMPIController, setup, submit=True):
780782 type = str ,
781783 default = None ,
782784 )
785+ parser .add_argument (
786+ '--n_steps' ,
787+ help = "number of steps" ,
788+ type = int ,
789+ default = None ,
790+ )
783791 args = parser .parse_args ()
784792
785793 if args .test == 'MSSDC' :
786- 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 )
787795 else :
788796 # test_generic_gusto_problem(setup)
789797 # test_pySDC_integrator_RK(False, RK4, setup)
0 commit comments