diff --git a/.github/workflows/ndsl-checks.yml b/.github/workflows/ndsl-checks.yml index 5d33c4152..d97a19abe 100644 --- a/.github/workflows/ndsl-checks.yml +++ b/.github/workflows/ndsl-checks.yml @@ -1,39 +1,58 @@ -name: NDSL checks +name: NDSL Lint & Translate Tests on: pull_request: branches: [ dsl/develop ] workflow_dispatch: +# cancel running jobs if theres a newer push +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: - lint: + main: + env: + DATA_PATH: ./test_data/11.5.2/TBC_C24_L72/moist + DATA_URL: "https://portal.nccs.nasa.gov/datashare/astg/smt/geos-fp/translate/11.5.2/x86_GNU/Moist/TBC_C24L72.tar.gz" runs-on: ubuntu-latest steps: - - name: Checkout NDSL - uses: actions/checkout@master - with: - repository: NOAA-GFDL/NDSL - submodules: 'recursive' - path: 'ndsl' - - name: Checkout repository - uses: actions/checkout@master - with: - submodules: 'recursive' - path: 'GCMGridComp' - - name: Step Python 3.11.9 - uses: actions/setup-python@v4.6.0 - with: - python-version: '3.11.9' - - name: Install OpenMPI for gt4py - run: | - sudo apt-get install libopenmpi-dev - - name: Install Python packages - run: | - python -m pip install --upgrade pip setuptools wheel pre-commit - cd ndsl - pip install -e .[develop] - pip install -e ../GCMGridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist - - name: Run lint via pre-commit - run: | - cd ./GCMGridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist - pre-commit run --all-files \ No newline at end of file + - name: Checkout NDSL + uses: actions/checkout@master + with: + repository: NOAA-GFDL/NDSL + submodules: 'recursive' + path: '${{ github.workspace }}/ndsl' + - name: Checkout repository + uses: actions/checkout@master + with: + submodules: 'recursive' + path: '${{ github.workspace }}/GCMGridComp' + - name: Step Python 3.11.9 + uses: actions/setup-python@v4.6.0 + with: + python-version: '3.11.9' + - name: Install OpenMPI for gt4py + run: | + sudo apt-get install libopenmpi-dev + - name: Install Python packages + run: | + python -m pip install --upgrade pip setuptools wheel pre-commit + cd ${{ github.workspace }}/ndsl + pip install -e .[develop] + cd ${{ github.workspace }}/GCMGridComp + pip install -e ./GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist + - name: Run lint via pre-commit + run: | + cd ${{ github.workspace }}/GCMGridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist + pre-commit run --all-files + - name: Download test_data (if not cached) + run: | + cd ${{ github.workspace }}/GCMGridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist + mkdir -p ${{ env.DATA_PATH }} && cd ${{ env.DATA_PATH }} + wget ${{ env.DATA_URL }} + tar -xzvf TBC_C24L72.tar.gz + - name: Run all tests + run: | + cd ${{ github.workspace }}/GCMGridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/ + ./run_all.sh ../../${{ env.DATA_PATH }} dace:cpu_kfirst diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/setup.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/setup.py index d966b1e35..815a707f2 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/setup.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/setup.py @@ -10,7 +10,7 @@ readme = readme_file.read() test_requirements = ["pytest", "pytest-subtests", "serialbox", "coverage"] -ndsl_requirements = ["ndsl @ git+https://github.com/NOAA-GFDL/NDSL.git@2025.10.00"] +ndsl_requirements = ["ndsl @ git+https://github.com/NOAA-GFDL/NDSL.git@develop"] develop_requirements = test_requirements + ndsl_requirements + ["pre-commit"] extras_requires = { diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/__init__.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/__init__.py index 5018802c2..6bbb13da3 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/__init__.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/savepoint/__init__.py @@ -20,3 +20,29 @@ from .saturation_tables.translate_saturation_tables import Translatesaturation_tables from .translate_aer_activation import TranslateAerActivation from .translate_compute_uwshcu import TranslateComputeUwshcuInv + + +__all__ = [ + "TranslateGFDL_1M_driver", + "TranslateGFDL_1M_driver_finish", + "TranslateGFDL_1M_driver_setup", + "TranslateGFDL_1M_fall_speed", + "TranslateGFDL_1M_ice_cloud", + "TranslateGFDL_1M_terminal_fall", + "TranslateGFDL_1M_warm_rain", + "TranslateGFDL_driver_tables", + "TranslateGFDL_1M_bergeron_partition", + "TranslateGFDL_1M_evaporate", + "TranslateGFDL_1M_hydrostatic_pdf", + "TranslateGFDL_1M_melt_freeze", + "TranslateGFDL_1M_phase_change", + "TranslateGFDL_1M_sublimate", + "TranslateGFDL_1M_finalize", + "TranslateGFDL_1M_radiation_coupling", + "TranslateGFDL_1M_redistribute_clouds", + "TranslateGFDL_1M_setup", + "Translateqsat_functions", + "Translatesaturation_tables", + "TranslateAerActivation", + "TranslateComputeUwshcuInv", +] diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/overrides.yml b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/overrides.yml index 113b3e297..546efea71 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/overrides.yml +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/overrides.yml @@ -4,3 +4,13 @@ ComputeUwshcuInv: absolute_epsilon: 1.00e-08 relative_fraction: 1.00e-04 ulp_threshold: 1700.0 + +GFDL_1M_sublimate: + - backend: dace:cpu_kfirst + multimodal: + ulp_threshold: 32 + +GFDL_1M_hydrostatic_pdf: + - backend: dace:cpu_kfirst + multimodal: + ulp_threshold: 250 diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/run_all.sh b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/run_all.sh new file mode 100755 index 000000000..7e74edd4e --- /dev/null +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/run_all.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Usage: ./run_tests.sh [/path/to/data] [debug|dace:cpu_kfirst] + +export NDSL_LITERAL_PRECISION=32 +export NDSL_TEST_N_THRESHOLD_SAMPLES=0 +export GT4PY_COMPILE_OPT_LEVEL=0 +export FV3_DACEMODE=Python +export NDSL_LOGLEVEL=Critical + +# UW specific +export GT4PY_EXTRA_COMPILE_OPT_FLAGS='-fconstexpr-ops-limit=1000000000' + +python -m pytest -s --disable-warnings --multimodal_metric \ + -x \ + --data_path=$1 \ + --backend=$2\ + --grid=default \ + --no_report \ + --threshold_overrides_file=./overrides.yml \ + .. diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/run_tests.sh b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/run_tests.sh index c91cf0105..dd8efe4e6 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/run_tests.sh +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests/scripts/run_tests.sh @@ -1,21 +1,21 @@ #!/bin/bash -#rm -rf ./.gt_cache_* -export PACE_FLOAT_PRECISION=32 -export GT4PY_LITERAL_PRECISION=32 -export PACE_TEST_N_THRESHOLD_SAMPLES=0 +# Usage: ./run_tests.sh [/path/to/data] [debug|dace:cpu_kfirst] [TranslateName] + +export NDSL_LITERAL_PRECISION=32 +export NDSL_TEST_N_THRESHOLD_SAMPLES=0 export GT4PY_COMPILE_OPT_LEVEL=0 export FV3_DACEMODE=Python -#export OPENMP_LDFLAGS="" -# export OPENMP_CPPFLAGS="-I/opt/homebrew/opt/libomp/include" -# export OPENMP_LDFLAGS="-L/opt/homebrew/opt/libomp/lib -lomp -Xpreprocessor -fopenmp" -#export GT4PY_EXTRA_COMPILE_OPT_FLAGS="-fbracket-depth=512" + +# UW specific export GT4PY_EXTRA_COMPILE_OPT_FLAGS='-fconstexpr-ops-limit=1000000000' + python -m pytest -s -v --disable-warnings --multimodal_metric \ - --data_path=/Users/kfandric/netcdf \ - --backend=dace:cpu\ - --which_rank=5 \ - --which_savepoint=0\ - --which_modules=ComputeUwshcuInv \ + -x \ + --data_path=$1 \ + --backend=$2\ + --which_modules=$3 \ --grid=default \ + --no_report \ + --threshold_overrides_file=./overrides.yml \ ..