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.13.4

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.13.4
File Actions
snapy-2.13.4-cp313-cp313-manylinux_2_27_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64 Details for snapy-2.13.4-cp313-cp313-manylinux_2_27_x86_64.whl
snapy-2.13.4-cp313-cp313-macosx_15_0_arm64.whl CPython 3.13 CPython 3.13 macOS 15.0+ ARM64 Details for snapy-2.13.4-cp313-cp313-macosx_15_0_arm64.whl
snapy-2.13.4-cp312-cp312-manylinux_2_27_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.27+ x86-64 Details for snapy-2.13.4-cp312-cp312-manylinux_2_27_x86_64.whl
snapy-2.13.4-cp312-cp312-macosx_15_0_arm64.whl CPython 3.12 CPython 3.12 macOS 15.0+ ARM64 Details for snapy-2.13.4-cp312-cp312-macosx_15_0_arm64.whl
snapy-2.13.4-cp311-cp311-manylinux_2_27_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64 Details for snapy-2.13.4-cp311-cp311-manylinux_2_27_x86_64.whl
snapy-2.13.4-cp311-cp311-macosx_15_0_arm64.whl CPython 3.11 CPython 3.11 macOS 15.0+ ARM64 Details for snapy-2.13.4-cp311-cp311-macosx_15_0_arm64.whl
snapy-2.13.4-cp310-cp310-manylinux_2_27_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.27+ x86-64 Details for snapy-2.13.4-cp310-cp310-manylinux_2_27_x86_64.whl
snapy-2.13.4-cp310-cp310-macosx_15_0_arm64.whl CPython 3.10 CPython 3.10 macOS 15.0+ ARM64 Details for snapy-2.13.4-cp310-cp310-macosx_15_0_arm64.whl

Total release size: 283.8 MB

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

Download URL snapy-2.13.4-cp313-cp313-manylinux_2_27_x86_64.whl
Size 66.0 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
34a7de62de712301ae4bf13a9328f03c27ce45929e959adcac396ea9db931e1b
BLAKE2b-256 checksum
How to use checksums
63c5564100d18ffa1ec868f1f2065cf040247b9fb1ece5d7a745b2c5ee03facd
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.13.4-cp313-cp313-macosx_15_0_arm64.whl

Download URL snapy-2.13.4-cp313-cp313-macosx_15_0_arm64.whl
Size 5.1 MB
Tags CPython 3.13 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
730b85a38057ca4a53dc02fd63f58a3c6cd3062f25db0ff7efe86ecc3490a077
BLAKE2b-256 checksum
How to use checksums
9f71f90ed9ecc7908351dad3c8f02a9ff9b1619460d5cbc10653f585a077a34d
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.13.4-cp312-cp312-manylinux_2_27_x86_64.whl

Download URL snapy-2.13.4-cp312-cp312-manylinux_2_27_x86_64.whl
Size 66.0 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
16e7e9213fefedbe5924aa2ed166dbd77064008dfd4ffd7540b7b4ef7a869f2a
BLAKE2b-256 checksum
How to use checksums
5d9b2d8952c4ae4c22946e11b4312d38f3db272b2067e9800c589935b6510334
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.13.4-cp312-cp312-macosx_15_0_arm64.whl

Download URL snapy-2.13.4-cp312-cp312-macosx_15_0_arm64.whl
Size 5.1 MB
Tags CPython 3.12 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
3f0e9606ee5bbc0aa2ab4490e99f418fdb390bf74ecffdcbbebc7c4b9bb14639
BLAKE2b-256 checksum
How to use checksums
4e42a65987a2262cd022ac5a8cef81119f41a3962b3c04bcb36e183e422f6403
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.13.4-cp311-cp311-manylinux_2_27_x86_64.whl

Download URL snapy-2.13.4-cp311-cp311-manylinux_2_27_x86_64.whl
Size 65.8 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
b4f818b86ce5ee4d547e911c599ba2e8148c0b4581c3806a5f81d1a8ff68af6e
BLAKE2b-256 checksum
How to use checksums
57732a8c7d03637c53d1e602fe2d0efea93b214317eec137d9993d8145cbd74a
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.13.4-cp311-cp311-macosx_15_0_arm64.whl

Download URL snapy-2.13.4-cp311-cp311-macosx_15_0_arm64.whl
Size 5.1 MB
Tags CPython 3.11 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
d28b7ca39d4dfc6c176d6cb23485b7aa98884ed4b1620db12b1ba5fae6a6e3b5
BLAKE2b-256 checksum
How to use checksums
d8d873acaaeca9c435c3a4a7c8adaa6c512a64e5e1406b45d325b371597aed8a
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.13.4-cp310-cp310-manylinux_2_27_x86_64.whl

Download URL snapy-2.13.4-cp310-cp310-manylinux_2_27_x86_64.whl
Size 65.6 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
284463f46013b6b1b6544df031023b5a950d383844ce39e18a41d6f870d168e3
BLAKE2b-256 checksum
How to use checksums
ddbe2760b7987858591efe0fb616d14e0439223c2776cc6387f2492cf5fdbd9f
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.13.4-cp310-cp310-macosx_15_0_arm64.whl

Download URL snapy-2.13.4-cp310-cp310-macosx_15_0_arm64.whl
Size 5.1 MB
Tags CPython 3.10 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
19070cca2b2e29535bdd8725ac83d396309ba736b3809d19fa57590e1e9dd953
BLAKE2b-256 checksum
How to use checksums
5086bc7e22487b38bf000790abce6071e5a12cd7410dc0fea2f271c9b55976a7
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.13.4

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.13.4 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