Skip to content

Commit

Permalink
properly fix parallel tests and add some plotting scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
tommbendall committed Sep 1, 2024
1 parent 3806cf6 commit 6c4435a
Show file tree
Hide file tree
Showing 12 changed files with 301 additions and 217 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ integration_test:

example:
@echo " Running all examples"
@python3 -m pytest examples -v -m "not mpiexec" $(PYTEST_ARGS)
@python3 -m pytest examples -v -m "not parallel" $(PYTEST_ARGS)

parallel_example:
@echo " Running all parallel examples"
@python3 -m pytest examples -v -m "mpiexec" $(PYTEST_ARGS)
@python3 -m pytest examples -v -m "parallel" $(PYTEST_ARGS)
48 changes: 9 additions & 39 deletions examples/boussinesq/test_boussinesq_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,9 @@ def test_skamarock_klemp_compressible_bouss():
)


@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_skamarock_klemp_compressible_bouss_parallel(mpiexec_n):
from skamarock_klemp_compressible import skamarock_klemp_compressible_bouss
test_name = 'skamarock_klemp_compressible_bouss'
skamarock_klemp_compressible_bouss(
ncolumns=30,
nlayers=5,
dt=6.0,
tmax=60.0,
dumpfreq=10,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=2)
def test_skamarock_klemp_compressible_bouss_parallel():
test_skamarock_klemp_compressible_bouss()


def test_skamarock_klemp_incompressible_bouss():
Expand All @@ -51,19 +41,9 @@ def test_skamarock_klemp_incompressible_bouss():
)


@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_skamarock_klemp_incompressible_bouss_parallel(mpiexec_n):
from skamarock_klemp_incompressible import skamarock_klemp_incompressible_bouss
test_name = 'skamarock_klemp_incompressible_bouss'
skamarock_klemp_incompressible_bouss(
ncolumns=30,
nlayers=5,
dt=60.0,
tmax=12.0,
dumpfreq=10,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=2)
def test_skamarock_klemp_incompressible_bouss_parallel():
test_skamarock_klemp_incompressible_bouss()


def test_skamarock_klemp_linear_bouss():
Expand All @@ -79,16 +59,6 @@ def test_skamarock_klemp_linear_bouss():
)


@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_skamarock_klemp_linear_bouss_parallel(mpiexec_n):
from skamarock_klemp_linear import skamarock_klemp_linear_bouss
test_name = 'skamarock_klemp_linear_bouss'
skamarock_klemp_linear_bouss(
ncolumns=30,
nlayers=5,
dt=60.0,
tmax=12.0,
dumpfreq=10,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=2)
def test_skamarock_klemp_linear_bouss_parallel():
test_skamarock_klemp_linear_bouss()
111 changes: 21 additions & 90 deletions examples/compressible/test_compressible_euler_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,9 @@ def test_dcmip_3_1_meanflow():
)


@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_dcmip_3_1_meanflow_parallel(mpiexec_n):
from dcmip_3_1_meanflow_quads import dcmip_3_1_meanflow
test_name = 'dcmip_3_1_meanflow'
dcmip_3_1_meanflow(
ncells_per_edge=4,
nlayers=4,
dt=100,
tmax=10000,
dumpfreq=10,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=6)
def test_dcmip_3_1_meanflow_parallel():
test_dcmip_3_1_meanflow()


def test_dry_bryan_fritsch():
Expand All @@ -51,19 +41,9 @@ def test_dry_bryan_fritsch():
)


@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_dry_bryan_fritsch_parallel(mpiexec_n):
from dry_bryan_fritsch import dry_bryan_fritsch
test_name = 'dry_bryan_fritsch'
dry_bryan_fritsch(
ncolumns=20,
nlayers=20,
dt=2.0,
tmax=20.0,
dumpfreq=10,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=4)
def test_dry_bryan_fritsch_parallel():
test_dry_bryan_fritsch()


# Hydrostatic equations not currently working
Expand All @@ -83,19 +63,9 @@ def test_mountain_hydrostatic():

# Hydrostatic equations not currently working
@pytest.mark.xfail
@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_mountain_hydrostatic_parallel(mpiexec_n):
from mountain_hydrostatic import mountain_hydrostatic
test_name = 'mountain_hydrostatic'
mountain_hydrostatic(
ncolumns=20,
nlayers=10,
dt=5.0,
tmax=50.0,
dumpfreq=10,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=4)
def test_mountain_hydrostatic_parallel():
test_mountain_hydrostatic()


# Hydrostatic equations not currently working
Expand All @@ -115,19 +85,9 @@ def test_skamarock_klemp_hydrostatic():

# Hydrostatic equations not currently working
@pytest.mark.xfail
@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_skamarock_klemp_hydrostatic_parallel(mpiexec_n):
from skamarock_klemp_hydrostatic import skamarock_klemp_hydrostatic
test_name = 'skamarock_klemp_hydrostatic'
skamarock_klemp_hydrostatic(
ncolumns=30,
nlayers=5,
dt=6.0,
tmax=60.0,
dumpfreq=10,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=2)
def test_skamarock_klemp_hydrostatic_parallel():
test_skamarock_klemp_hydrostatic()


def test_skamarock_klemp_nonhydrostatic():
Expand All @@ -143,19 +103,9 @@ def test_skamarock_klemp_nonhydrostatic():
)


@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_skamarock_klemp_nonhydrostatic_parallel(mpiexec_n):
from skamarock_klemp_nonhydrostatic import skamarock_klemp_nonhydrostatic
test_name = 'skamarock_klemp_nonhydrostatic'
skamarock_klemp_nonhydrostatic(
ncolumns=30,
nlayers=5,
dt=6.0,
tmax=60.0,
dumpfreq=10,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=2)
def test_skamarock_klemp_nonhydrostatic_parallel():
test_skamarock_klemp_nonhydrostatic()


def test_straka_bubble():
Expand All @@ -170,18 +120,9 @@ def test_straka_bubble():
)


@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_straka_bubble_parallel(mpiexec_n):
from straka_bubble import straka_bubble
test_name = 'straka_bubble'
straka_bubble(
nlayers=6,
dt=4.0,
tmax=40.0,
dumpfreq=10,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=3)
def test_straka_bubble_parallel():
test_straka_bubble()


def test_unsaturated_bubble():
Expand All @@ -197,16 +138,6 @@ def test_unsaturated_bubble():
)


@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_unsaturated_bubble_parallel(mpiexec_n):
from unsaturated_bubble import unsaturated_bubble
test_name = 'unsaturated_bubble'
unsaturated_bubble(
ncolumns=20,
nlayers=20,
dt=1.0,
tmax=10.0,
dumpfreq=10,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=2)
def test_unsaturated_bubble_parallel():
test_unsaturated_bubble()
105 changes: 21 additions & 84 deletions examples/shallow_water/test_shallow_water_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,9 @@ def test_linear_williamson_2():
)


@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_linear_williamson_2_parallel(mpiexec_n):
from linear_williamson_2 import linear_williamson_2
test_name = 'linear_williamson_2'
linear_williamson_2(
ncells_per_edge=4,
dt=1800.,
tmax=18000.,
dumpfreq=10,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=2)
def test_linear_williamson_2_parallel():
test_linear_williamson_2()


def test_moist_convective_williamson_2():
Expand All @@ -48,18 +39,9 @@ def test_moist_convective_williamson_2():
)


@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_moist_convective_williamson_2_parallel(mpiexec_n):
from moist_convective_williamson_2 import moist_convect_williamson_2
test_name = 'moist_convective_williamson_2'
moist_convect_williamson_2(
ncells_per_edge=4,
dt=1800.,
tmax=18000.,
dumpfreq=10,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=2)
def test_moist_convective_williamson_2_parallel():
test_moist_convective_williamson_2()


def test_moist_thermal_williamson_5():
Expand All @@ -74,18 +56,9 @@ def test_moist_thermal_williamson_5():
)


@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_moist_thermal_williamson_5_parallel(mpiexec_n):
from moist_thermal_williamson_5 import moist_thermal_williamson_5
test_name = 'moist_thermal_williamson_5'
moist_thermal_williamson_5(
ncells_per_edge=4,
dt=1800.,
tmax=18000.,
dumpfreq=10,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=2)
def test_moist_thermal_williamson_5_parallel():
test_moist_thermal_williamson_5()


def test_shallow_water_1d_wave():
Expand All @@ -100,18 +73,9 @@ def test_shallow_water_1d_wave():
)


@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_shallow_water_1d_wave_parallel(mpiexec_n):
from shallow_water_1d_wave import shallow_water_1d_wave
test_name = 'shallow_water_1d_wave'
shallow_water_1d_wave(
ncells=20,
dt=1.0e-4,
tmax=1.0e-3,
dumpfreq=2,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=4)
def test_shallow_water_1d_wave_parallel():
test_shallow_water_1d_wave()


def test_thermal_williamson_2():
Expand All @@ -126,18 +90,9 @@ def test_thermal_williamson_2():
)


@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_thermal_williamson_2_parallel(mpiexec_n):
from thermal_williamson_2 import thermal_williamson_2
test_name = 'thermal_williamson_2'
thermal_williamson_2(
ncells_per_edge=4,
dt=1800.,
tmax=18000.,
dumpfreq=10,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=4)
def test_thermal_williamson_2_parallel():
test_thermal_williamson_2()


def test_williamson_2():
Expand All @@ -152,18 +107,9 @@ def test_williamson_2():
)


@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_williamson_2_parallel(mpiexec_n):
from williamson_2 import williamson_2
test_name = 'williamson_2'
williamson_2(
ncells_per_edge=4,
dt=1800.,
tmax=18000.,
dumpfreq=10,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=4)
def test_williamson_2_parallel():
test_williamson_2()


def test_williamson_5():
Expand All @@ -178,15 +124,6 @@ def test_williamson_5():
)


@pytest.mark.mpiexec
@pytest.mark.parametrize("mpiexec_n", [4])
def test_williamson_5_parallel(mpiexec_n):
from williamson_5 import williamson_5
test_name = 'williamson_5'
williamson_5(
ncells_per_edge=4,
dt=1800.,
tmax=18000.,
dumpfreq=10,
dirname=make_dirname(test_name)
)
@pytest.mark.parallel(nprocs=4)
def test_williamson_5_parallel():
test_williamson_5()
Binary file added figures/compressible_euler/dry_bryan_fritsch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/compressible_euler/straka_bubble.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6c4435a

Please sign in to comment.