Skip to main content

Snapy

Compressible Finite Volume Solver for Atmospheric Dynamics, Chemistry and Thermodynamics

Snapy is the dynamic core for simulating atmospheric and planetary dynamics using PyTorch tensors and GPU acceleration.

PyPI version License: MIT

Features

  • GPU-Accelerated: Built on PyTorch for efficient GPU computation
  • Flexible Interfaces: Both Python and C++ APIs available
  • Compressible Flow: Finite volume solver for atmospheric dynamics
  • Multi-platform: Support for Linux and macOS
  • NetCDF Output: Standard output format for scientific data

Installation

Quick Install (Python Interface)

The easiest way to get started is to install via pip:

pip install snapy

This will install the Python interface with pre-built binaries for Python 3.9-3.13 on Linux (x86_64) and macOS (ARM64).

Parallel run

pd-run 6 ./test_exchange.release

list listening port

lsof -i:29500

kill listening port

pkill -9 XXXXX

Requirements:

  • Python 3.9 or higher
  • PyTorch 2.10.x
  • NumPy
  • kintera >= 2.6.3

Build from Source (Advanced)

Building from source is recommended only for advanced users who need to:

  • Modify the C++ core
  • Use custom PyTorch versions
  • Access the C++ interface directly
  • Develop new features

Prerequisites:

  • CMake 3.20+
  • C++17 compatible compiler
  • Autoconf, Automake, Libtool, and pkg-config on Linux (for fetched UCX)
  • PyTorch 2.10.x with C++ libraries
  • NetCDF C library
  • kintera >= 2.6.3

Build steps:

  1. Clone the repository:
git clone https://github.com/chengcli/snapy.git
cd snapy
  1. Install dependencies:
pip install numpy "kintera>=2.6.3" torch==2.10.0
  1. Install NetCDF:
    • Linux (Ubuntu/Debian):
      sudo apt-get install libnetcdf-dev
      
    • macOS:
      brew install netcdf
      

UCX support is provided by the Python package commux. Install snapy's Python dependencies in the active environment before configuring; use -DUCX=OFF only when building a Gloo-only configuration.

  1. Configure and build:
cmake -B build -DCMAKE_BUILD_TYPE=Release -DNETCDF=ON
cmake --build build --parallel 3
  1. Install the Python package:
pip install .

Examples

The examples/ directory contains several working examples:

Python Examples:

  • shock.py - Sod shock tube with internal boundary
  • straka.py - Straka cold bubble convection test
  • robert.py - Robert warm bubble convection test

C++ Examples:

  • shock.cpp - Sod shock tube (C++)
  • straka.cpp - Straka cold bubble (C++)

Run a Python example:

cd examples
python shock.py

Run a C++ example (after building):

cd build/examples
./shock

See examples/README for detailed documentation on the code structure and available examples.

Configuration

Simulations are configured using YAML files that specify:

  • Grid dimensions and domain size
  • Time integration settings (RK stages, CFL number)
  • Boundary conditions
  • Output settings (frequency, variables, format)
  • Equation of state and thermodynamics

Example configuration files (.yaml) are provided alongside the examples.

Run-wide scheme switches are read once from the environment. The x2/x3 face-flux covariance correction (SNAP_FLUX_COVARIANCE, #289; docs/derivations/289-covariance-x3-curved.md) is on by default; set SNAP_FLUX_COVARIANCE=0 (or false, off, no) to turn it off.

Development

Testing

Run tests after building:

cd build/tests
ctest --output-on-failure

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

Metadata

Release files for snapy 2.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for snapy 2.12.0
File Actions
snapy-2.12.0-cp313-cp313-manylinux_2_27_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64 Details for snapy-2.12.0-cp313-cp313-manylinux_2_27_x86_64.whl
snapy-2.12.0-cp313-cp313-macosx_15_0_arm64.whl CPython 3.13 CPython 3.13 macOS 15.0+ ARM64 Details for snapy-2.12.0-cp313-cp313-macosx_15_0_arm64.whl
snapy-2.12.0-cp312-cp312-manylinux_2_27_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.27+ x86-64 Details for snapy-2.12.0-cp312-cp312-manylinux_2_27_x86_64.whl
snapy-2.12.0-cp312-cp312-macosx_15_0_arm64.whl CPython 3.12 CPython 3.12 macOS 15.0+ ARM64 Details for snapy-2.12.0-cp312-cp312-macosx_15_0_arm64.whl
snapy-2.12.0-cp311-cp311-manylinux_2_27_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64 Details for snapy-2.12.0-cp311-cp311-manylinux_2_27_x86_64.whl
snapy-2.12.0-cp311-cp311-macosx_15_0_arm64.whl CPython 3.11 CPython 3.11 macOS 15.0+ ARM64 Details for snapy-2.12.0-cp311-cp311-macosx_15_0_arm64.whl
snapy-2.12.0-cp310-cp310-manylinux_2_27_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.27+ x86-64 Details for snapy-2.12.0-cp310-cp310-manylinux_2_27_x86_64.whl
snapy-2.12.0-cp310-cp310-macosx_15_0_arm64.whl CPython 3.10 CPython 3.10 macOS 15.0+ ARM64 Details for snapy-2.12.0-cp310-cp310-macosx_15_0_arm64.whl

Total release size: 275.2 MB

Release files / snapy-2.12.0-cp313-cp313-manylinux_2_27_x86_64.whl

Download URL snapy-2.12.0-cp313-cp313-manylinux_2_27_x86_64.whl
Size 64.0 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
e24028103258a76edf5e621ebe988386a860ca9caadb1476a2ecb5c86c1a2011
BLAKE2b-256 checksum
How to use checksums
03716875be790e759f608c81c4195589ce0e44a0bb3a9b5fd33a190db8b82cdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / snapy-2.12.0-cp313-cp313-macosx_15_0_arm64.whl

Download URL snapy-2.12.0-cp313-cp313-macosx_15_0_arm64.whl
Size 5.0 MB
Tags CPython 3.13 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
d0d76253f6323d9fd5ed5622a79ba05fcc1fd6e237ed50d3114079f842940a66
BLAKE2b-256 checksum
How to use checksums
07874dbc96dcd74737110c98d9cbc2100997be5ddfaf4800e7fc890c17cc3974
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / snapy-2.12.0-cp312-cp312-manylinux_2_27_x86_64.whl

Download URL snapy-2.12.0-cp312-cp312-manylinux_2_27_x86_64.whl
Size 64.0 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
9290b98710016c8570ea42416d8cb1b27b7a5c8eda07d879582c28ff1b0df5e3
BLAKE2b-256 checksum
How to use checksums
645684e827ea5034004f920007953955230f2b1b9c94ce021054cb419648b796
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / snapy-2.12.0-cp312-cp312-macosx_15_0_arm64.whl

Download URL snapy-2.12.0-cp312-cp312-macosx_15_0_arm64.whl
Size 5.0 MB
Tags CPython 3.12 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
a240b271133d632313044863c62f2d2c3180cb07e460b7a1801b7412bc8881d4
BLAKE2b-256 checksum
How to use checksums
088a9f31ab259ad28a8b633eb97af42bb63d5190df33139a987902482cd77ee7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / snapy-2.12.0-cp311-cp311-manylinux_2_27_x86_64.whl

Download URL snapy-2.12.0-cp311-cp311-manylinux_2_27_x86_64.whl
Size 63.8 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
57d4efc0edfeac500e60f6f17f8c83e5e882b9bd6f160a541efa995499dd92cb
BLAKE2b-256 checksum
How to use checksums
14d3a9907c4e8dd24db34fddeb84c5cb8495391e691a74cd940a26bc6f618718
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / snapy-2.12.0-cp311-cp311-macosx_15_0_arm64.whl

Download URL snapy-2.12.0-cp311-cp311-macosx_15_0_arm64.whl
Size 5.0 MB
Tags CPython 3.11 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
6877d0ff8b14a97081155543d069179e555bea2272f193887b40a1243c2821f3
BLAKE2b-256 checksum
How to use checksums
d2b7195b87bce34fce0ecd709c089c4dd3ead732fc91124e0b24e0e8f551bbb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / snapy-2.12.0-cp310-cp310-manylinux_2_27_x86_64.whl

Download URL snapy-2.12.0-cp310-cp310-manylinux_2_27_x86_64.whl
Size 63.6 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
5b713440fc003c460c6b81af6a210c39ebc9c203e0d04808b9ec89d9204bb18a
BLAKE2b-256 checksum
How to use checksums
58c591f0598be65bf3cf5f55a311b47f242688fc1b43efe7ac14173d554cff6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / snapy-2.12.0-cp310-cp310-macosx_15_0_arm64.whl

Download URL snapy-2.12.0-cp310-cp310-macosx_15_0_arm64.whl
Size 5.0 MB
Tags CPython 3.10 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
e24b3062aaa1821cfd5b0c813bf725cf684c44ac6321d5515fd85443f035b8a4
BLAKE2b-256 checksum
How to use checksums
e5d28d7b05d46756df8c05f0aad5dc2ff5b68ebddc49aff883b00cdf653c9f83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for snapy 2.12.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.12.0 This release

8 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page