Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "pySHiELD tests"

# Run these these whenever ...
on:
pull_request: # ... a PR is opened / updated
merge_group: # ... the PR is added to the merge queue
push:
branches:
- main # ... when merging into the main branch

# cancel running jobs if theres a newer push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
integration-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: 'recursive'

- name: Setup Python 3.11
uses: actions/setup-python@v6
with:
python-version: '3.11'

- name: Install mpi (MPICH flavor)
run: pip install mpich

- name: Install Python packages
run: pip install .[ndsl,pyfv3,test]

- name: Run integration tests
run: pytest tests/integration

radiation-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: 'recursive'

- name: Setup Python 3.11
uses: actions/setup-python@v6
with:
python-version: '3.11'

- name: Install mpi (MPICH flavor)
run: pip install mpich

- name: Install Python packages
run: pip install .[ndsl,pyfv3,test]

- name: Run radiation tests
run: pytest tests/rte_rrtmgp
Empty file modified README.md
100755 → 100644
Empty file.
6 changes: 3 additions & 3 deletions examples/notebook/test_rad.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "e2411282-0778-4af1-83d3-4e3d372ab519",
"metadata": {},
"outputs": [
Expand All @@ -37,7 +37,7 @@
"source": [
"import xarray as xr\n",
"import ndsl.dsl.gt4py_utils as gt_utils\n",
"from ndsl import GridSizer, Quantity, QuantityFactory, TileCommunicator, TilePartitioner, NullComm, SubtileGridSizer\n",
"from ndsl import GridSizer, Quantity, QuantityFactory, TileCommunicator, TilePartitioner, LocalComm, SubtileGridSizer\n",
"import ndsl.constants as constants\n",
"\n",
"from pyshield.radiation.state import RTE_RRTMGPState\n",
Expand Down Expand Up @@ -90,7 +90,7 @@
"rank = 0\n",
"backend = \"numpy\"\n",
"\n",
"comm = NullComm(rank, 1)\n",
"comm = LocalComm(rank, total_ranks=1, buffer_dict={})\n",
"communicator = TileCommunicator.from_layout(comm=comm, layout=(1,1))\n",
"\n",
"sizer = SubtileGridSizer.from_tile_params(\n",
Expand Down
6 changes: 3 additions & 3 deletions examples/notebook/test_raddriver.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "ea4d7298-a2bc-4283-a038-b2f5c96d9c20",
"metadata": {},
"outputs": [
Expand All @@ -29,7 +29,7 @@
"source": [
"import xarray as xr\n",
"import ndsl.dsl.gt4py_utils as gt_utils\n",
"from ndsl import GridSizer, Quantity, QuantityFactory, TileCommunicator, TilePartitioner, NullComm, SubtileGridSizer\n",
"from ndsl import GridSizer, Quantity, QuantityFactory, TileCommunicator, TilePartitioner, LocalComm, SubtileGridSizer\n",
"import ndsl.constants as constants\n",
"\n",
"from pyshield.radiation import RTE_RRTMGPState, RTE_RRTMGPConfig, RTE_RRTMGPDriver\n",
Expand Down Expand Up @@ -76,7 +76,7 @@
"rank = 0\n",
"backend = \"numpy\"\n",
"\n",
"comm = NullComm(rank, 1)\n",
"comm = LocalComm(rank, total_ranks=1, buffer_dict={})\n",
"communicator = TileCommunicator.from_layout(comm=comm, layout=(1,1))\n",
"\n",
"sizer = SubtileGridSizer.from_tile_params(\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/notebook/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import xarray as xr

from ndsl import NullComm, Quantity, QuantityFactory, TileCommunicator
from ndsl import LocalComm, Quantity, QuantityFactory, TileCommunicator
from ndsl.boilerplate import get_factories_single_tile
from ndsl.grid import (
AngleGridData,
Expand Down Expand Up @@ -102,7 +102,7 @@ def setup_infrastructure(
nx=nx, ny=ny, nz=nz, nhalo=nhalo, backend=backend
)
rank = 0
comm = NullComm(rank, 1)
comm = LocalComm(rank, total_ranks=1, buffer_dict={})
communicator = TileCommunicator.from_layout(comm=comm, layout=(1, 1))

metric_terms = MetricTerms(
Expand Down
Binary file added test_data/RESTART/eta91.nc
Binary file not shown.
4 changes: 2 additions & 2 deletions tests/integration/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import ndsl.constants as constants
import pyshield.constants as physcons
from ndsl import NullComm, Quantity, QuantityFactory, StencilFactory, TileCommunicator
from ndsl import LocalComm, Quantity, QuantityFactory, StencilFactory, TileCommunicator
from ndsl.boilerplate import get_factories_single_tile
from ndsl.grid import (
AngleGridData,
Expand Down Expand Up @@ -41,7 +41,7 @@ def setup_infrastructure(
nx=nx, ny=ny, nz=nzsoil, nhalo=nhalo, backend=backend
)
rank = 0
comm = NullComm(rank, 1)
comm = LocalComm(rank, total_ranks=1, buffer_dict={})
communicator = TileCommunicator.from_layout(comm=comm, layout=(1, 1))

metric_terms = MetricTerms(
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_gfdl_cld_mp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import ndsl.constants as constants
import pyshield.constants as physcons
from ndsl import NullComm, Quantity, QuantityFactory, StencilFactory, TileCommunicator
from ndsl import LocalComm, Quantity, QuantityFactory, StencilFactory, TileCommunicator
from ndsl.boilerplate import get_factories_single_tile
from ndsl.grid import (
AngleGridData,
Expand All @@ -27,7 +27,7 @@ def setup_infrastructure(
nx=nx, ny=ny, nz=nz, nhalo=nhalo, backend=backend
)
rank = 0
comm = NullComm(rank, 1)
comm = LocalComm(rank, total_ranks=1, buffer_dict={})
communicator = TileCommunicator.from_layout(comm=comm, layout=(1, 1))

metric_terms = MetricTerms(
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_gfs_mp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import ndsl.constants as constants
import pyshield.constants as physcons
from ndsl import NullComm, Quantity, QuantityFactory, StencilFactory, TileCommunicator
from ndsl import LocalComm, Quantity, QuantityFactory, StencilFactory, TileCommunicator
from ndsl.boilerplate import get_factories_single_tile
from ndsl.grid import (
AngleGridData,
Expand All @@ -26,7 +26,7 @@ def setup_infrastructure(
nx=nx, ny=ny, nz=nz, nhalo=nhalo, backend=backend
)
rank = 0
comm = NullComm(rank, 1)
comm = LocalComm(rank, total_ranks=1, buffer_dict={})
communicator = TileCommunicator.from_layout(comm=comm, layout=(1, 1))

metric_terms = MetricTerms(
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_radiation_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest
import xarray as xr

from ndsl import NullComm, Quantity, QuantityFactory, TileCommunicator
from ndsl import LocalComm, Quantity, QuantityFactory, TileCommunicator
from ndsl.boilerplate import get_factories_single_tile
from ndsl.grid import (
AngleGridData,
Expand All @@ -29,7 +29,7 @@ def setup_infrastructure(
nx=nx, ny=ny, nz=nz, nhalo=nhalo, backend=backend
)
rank = 0
comm = NullComm(rank, 1)
comm = LocalComm(rank, total_ranks=1, buffer_dict={})
communicator = TileCommunicator.from_layout(comm=comm, layout=(1, 1))

metric_terms = MetricTerms(
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_samfshalconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import ndsl.constants as constants
import pyshield.constants as physcons
from ndsl import NullComm, Quantity, QuantityFactory, StencilFactory, TileCommunicator
from ndsl import LocalComm, Quantity, QuantityFactory, StencilFactory, TileCommunicator
from ndsl.boilerplate import get_factories_single_tile
from ndsl.grid import (
AngleGridData,
Expand All @@ -27,7 +27,7 @@ def setup_infrastructure(
nx=nx, ny=ny, nz=nz, nhalo=nhalo, backend=backend
)
rank = 0
comm = NullComm(rank, 1)
comm = LocalComm(rank, total_ranks=1, buffer_dict={})
communicator = TileCommunicator.from_layout(comm=comm, layout=(1, 1))

metric_terms = MetricTerms(
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_satmedmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import ndsl.constants as constants
import pyshield.constants as physcons
from ndsl import NullComm, Quantity, QuantityFactory, StencilFactory, TileCommunicator
from ndsl import LocalComm, Quantity, QuantityFactory, StencilFactory, TileCommunicator
from ndsl.boilerplate import get_factories_single_tile
from ndsl.grid import (
AngleGridData,
Expand All @@ -27,7 +27,7 @@ def setup_infrastructure(
nx=nx, ny=ny, nz=nz, nhalo=nhalo, backend=backend
)
rank = 0
comm = NullComm(rank, 1)
comm = LocalComm(rank, total_ranks=1, buffer_dict={})
communicator = TileCommunicator.from_layout(comm=comm, layout=(1, 1))

metric_terms = MetricTerms(
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_sfc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ndsl import (
CompilationConfig,
GridIndexing,
NullComm,
LocalComm,
Quantity,
QuantityFactory,
StencilConfig,
Expand Down Expand Up @@ -115,7 +115,7 @@ def setup_infrastructure(nx: Int, ny: Int, nz: Int, nzsoil: Int, etafile: Path):
rank = 0
backend = "numpy"

comm = NullComm(rank, 1)
comm = LocalComm(rank, total_ranks=1, buffer_dict={})
communicator = TileCommunicator.from_layout(comm=comm, layout=(1, 1))

sizer = SubtileGridSizer.from_tile_params(
Expand Down
Loading