Skip to main content

Add your description here

Project description

ice3-logo

coverage-badge

ICE3 microphysics on gt4py.

dwarf-p-ice3 is a porting of ice3 microphysics with Python and GT4Py dsl. Original source code can be retrieved on PHYEX repository or updated as a submodule in this project -via install.sh script.

The official version for reproducibility is CY50T1.

Installation and build

LUMI

Data must be setup on the scratch.

Run debug :

Run GPU :

  • Module load + environment variables
    source ./config/lumi/lumi_env
  • Interactive session
    srun --nodes=1  \
    --ntasks-per-node=1 \
    --cpus-per-task=56 \
    --gpus-per-node=1 \
    --account=project_465000527 \
    --partition=dev-g \
    --time=03:00:00  \
    --mem=0 \
    --pty bash
  • Launch
    uv run standalone-model ice-adjust-split \
    gt:gpu \
    $SCRATCH_PATH/data/ice_adjust/reference.nc \
    $SCRATCH_PATH/data/ice_adjust/run.nc \
    track_ice_adjust.json

Warning

It works well with cupy 14.0 and the last versions of gt4py.cartesian (see config pyproject.toml)

Atos ECMWF

Leonardo

Working with Containers

container is defined to run dwarf-p-ice3 inside a container with nvidia runtime and python dependencies.

Build

    sudo docker build -t ice3 ./dwarf-p-ice3/container

WIP

  • Push / Pull from registry
  • Setup .devcontainer to develop ice3 inside an isolated virtual env with access to gpus
  • Setup singularity image to run on an HPC cluster
  • (Nice to have) install dependencies with spack

Data generation for reproductibility

Data generation script is made to transform .dat files from PHYEX to netcdf with named fields. .dat files are retrieved from PHYEX reproductibility sets (testprogs_data).

Load PHYEX testprogs dataset :

  • ice_adjust
  cd ./data/
  wget --no-check-certificate https://github.com/UMR-CNRM/PHYEX/files/12783926/ice_adjust.tar.gz \
   -O ice_adjust.tar.gz
  tar xf ice_adjust.tar.gz
  rm -f ice_adjust.tar.gz
  cd ..
  • rain_ice :
  cd ./data/
  wget --no-check-certificate https://github.com/UMR-CNRM/PHYEX/files/12783935/rain_ice.tar.gz \
  -O rain_ice.tar.gz
  tar xf ice_adjust.tar.gz
  rm -f ice_adjust.tar.gz
  cd ..

Decode files to netcdf :

   uv run testprogs-data extract-data-ice-adjust \
   data/ice_adjust/ \
   reference.nc \
   ./src/testprogs_data/ice_adjust.yaml 

Microphysical Adjustments (Ice Adjust)

There are three components available for microphysical adjustments, under /src/ice3_gt4py/components directory:

  • IceAdjust (ice_adjust.py) : performs condensation and adjustements following supersaturation, and is the mirror of PHYEX's ice_adjust.F90,
  • AroAdjust (aro_adjust.py) : combines both stencil collections to reproduce aro_adjust.F90.
  • To launch ice_adjust (with cli):
  uv run standalone-model ice-adjust-split \
  gt:cpu_kfirst \
  ./data/ice_adjust/reference.nc \
  ./data/ice_adjust/run.nc \
  track_ice_adjust.json --no-rebuild 

(WIP) Integration with PHYEX

  • Option 1:

    • intégration par Serialbox dans IAL_de330 sous ecbuild
    • édition de lien vers Serialbox à faire
  • Option 2:

    • intégration des fonctions DaCe (C++)

(WIP) Integration with PMAP-L

  • Option 1:
    • Intégration Python (nécessite peut-être de la réécriture de composants).

Rain Ice

There are three components available for rain_ice (one-moment microphysical processes computation), under /src/ice3_gt4py/components directory:

  • RainIce (rain_ice.py) : calls stencils involved in RainIce computation,
  • AroRainIce (aro_rain_ice.py) : calls RainIce common computation plus non-negative filters for model coupling,
  • Ice4Tendencies (ice4_tendencies.py) : responsible for processes computation,
  • Ice4Stepping (ice4_stepping.py) : responsible for orchestration of processes computations (handling soft and heavy cycles plus accumulating tendencies).
  • To launch rain_ice (with cli):
    uv run standalone-model ice-adjust-split \
    gt:cpu_kfirst \
    ./data/ice_adjust/reference.nc \
    ./data/ice_adjust/run.nc \
    track_ice_adjust.json --no-rebuild 

Unit tests

Unit tests for reproductibility are using pytest. Numpy, CPU and GPU backends can be activated :

  • Numpy :
    uv run pytest tests/repro -m debug 
    
  • CPU :
    uv run pytest tests/repro -m cpu
    
  • GPU :
    uv run pytest tests/repro -m gpu
    

Fortran and GT4Py stencils can be tested side-by-side with test components (stencil_fortran directory).

Fortran routines are issued from CY49T0 version of the code and reworked to eliminate derivate types from routines. Then both stencils are ran with random numpy arrays as an input.

  • conftest.py :
    • tous les utilitaires pour
    • les tests : grille, domain, origine de test et config gt4py
    • compile_fortran_stencil(fichier, module, subroutine)

Continuous benchmarking

Components under (components)[tests/components] are monitored with continuous benchmarking.

  bencher run --adapter json \
  --file result.json \
  --token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhcGlfa2V5IiwiZXhwIjo2MDUzMDYzNjUzLCJpYXQiOjE3NTgwOTYzNTgsImlzcyI6ImJlbmNoZXIuZGV2Iiwic3ViIjoibWF1cmluLmxvaWMuYWNAZ21haWwuY29tIiwib3JnIjpudWxsLCJzdGF0ZSI6bnVsbH0.WakXPCmj4Rj0wup8FqhO1h66brXEwktNd4J7VggOano \
  "uv run pytest tests/components/test_ice_adjust.py -m debug"

Python Wrapper

  uv run standalone-model ice-adjust-fortran\
  ../phyex/lib/libice-adjust.so \
  ./data/ice_adjust/reference.nc \
  ./data/ice_adjust/run.nc \
  track_ice_adjust.json

Structure du projet

  • src
    • drivers : Command Line Interface'
    • ice3_gt4py :
      • stencils : stencils gt4py et dace
      • functions : fonctions gt4py
      • initialisation : initialisation des champs (arrays)
      • phyex_common : équivalents des modd en python : les modd ont été recodés en dataclasses
      • stencils_fortran : équivalent fortran des stencisl gt4py (modules + 1 subroutine = 1 stencil gt4py)
      • utils : utilitaires pour la config et l'allocation des champs
    • testprogs_data :
      • main : Command Line Interface pour le décodage des testprogs phyex
      • .yaml : config de décodage des fichiers

Work in Progress

  • branche ice_adjust_review :

    • tous les stencils ont été testés unitairement (y compris l'interpolation en DaCe).
    • l'interpolation (sigrc_computation_dace) doit, être intégrée au composant ice_adjust_split -> Couplage stencil dace + stencil gt4py à investiguer
    • il y a un bug, les stencils cloud_fraction_1 et cloud_fraction_2 renvoient des valeurs nulles -> Les variables inout doivent être découpées en in / out
  • branche rain_ice_review :

    • tous les stencils des tendances (Ice4Tendencies) ont été testés
    • les stencils dace ice4_fast_rs (2 stencils gt4py + 2 stencils DaCe) et ice4_fast_rg doivent être intégrés au composant
    • les appels des stencils de Ice4Tendencies doivent être mis à jour (débuggage)
    • les tests unitaires sur le stepping ne sont pas nécessaire -> il est préférable de tester le composant dans un cas simple (1 boucle ldsoft)
    • les tests unitaires des rain_fr et sedimentation sont à réaliser
  • branches expérimentales :

    • dace-interpolation : intégration des interpolations DaCe dans le stencil
    • dace-orchestration : orchestration DaCe des composants pour livraison en standalone et l'intégration à pmapl : un composant DaCe fournit sa librairie partagée à la compilation,
    • fortran-plugin : branche pour évaluer les branchements des composants DaCe (code complet) dans fortran

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dwarf_p_ice3-0.1.0.tar.gz (11.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dwarf_p_ice3-0.1.0-py3-none-any.whl (231.2 kB view details)

Uploaded Python 3

File details

Details for the file dwarf_p_ice3-0.1.0.tar.gz.

File metadata

  • Download URL: dwarf_p_ice3-0.1.0.tar.gz
  • Upload date:
  • Size: 11.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for dwarf_p_ice3-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bf4f46cb3507dc3dd9eeeb12948fd83b9603dca68ae261ab7018b6e06f26aa06
MD5 00d602e901d399ef06af818f5f3aaf1d
BLAKE2b-256 577163f039ad398c102a7d01654a807d95685a4c694f543a33df4fda4657b3ad

See more details on using hashes here.

File details

Details for the file dwarf_p_ice3-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dwarf_p_ice3-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 231.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for dwarf_p_ice3-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c533acf0983d0b25ba1571ad8abcecc77dee46342d6f40df62dc9619b52e609
MD5 6274e30ac110dc5c135b92c021064345
BLAKE2b-256 4ed98e7b9cd21fa55db6f0e37e3cc2cd9d62ff203dc09d35c2297bf4111a71c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page