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

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

Total release size: 274.8 MB

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

Download URL snapy-2.11.16-cp313-cp313-manylinux_2_27_x86_64.whl
Size 63.9 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
25c11dd9b29c5bc5375c143fe1f7cb90054e7ff3d88d0368a2ce1a67b677586a
BLAKE2b-256 checksum
How to use checksums
34aabfbfb28d2975508249501925054e523c4e208d498783f9cd6caa7edf7494
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.11.16-cp313-cp313-macosx_15_0_arm64.whl

Download URL snapy-2.11.16-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
b68c7742584bded61805504c2a5ec13dadadf49ee76e43cf95e34ed0b821870f
BLAKE2b-256 checksum
How to use checksums
0f808aa1b8b73a40abff1fc2a16119758de967dfad8bbdc667588c08c8ecf63b
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.11.16-cp312-cp312-manylinux_2_27_x86_64.whl

Download URL snapy-2.11.16-cp312-cp312-manylinux_2_27_x86_64.whl
Size 63.9 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
fb7f2aa547224275846de49ed32141a48d878e0e09a40bbc833bda1b458ce770
BLAKE2b-256 checksum
How to use checksums
b0a0a1aed112476efaeb29d68773d76481135d2934b7b47af5de96005b5e469f
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.11.16-cp312-cp312-macosx_15_0_arm64.whl

Download URL snapy-2.11.16-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
163fb733ec5f3c511466d89c3820274c79f664341d4485babc52121df2a85f01
BLAKE2b-256 checksum
How to use checksums
3646f30a405f40f31cdbacd1916a6aef066a0d7b5e603f85eeea3d65353e07a5
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.11.16-cp311-cp311-manylinux_2_27_x86_64.whl

Download URL snapy-2.11.16-cp311-cp311-manylinux_2_27_x86_64.whl
Size 63.7 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
dbe4e7b752740bf6f712a84eaa3329a72999be5ea050f6dfec753515b130ba9c
BLAKE2b-256 checksum
How to use checksums
c82e2baa4f440f7bab2e8d01f7d3cc8f9ada5881f9d7b32a2500b81891892c60
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.11.16-cp311-cp311-macosx_15_0_arm64.whl

Download URL snapy-2.11.16-cp311-cp311-macosx_15_0_arm64.whl
Size 4.9 MB
Tags CPython 3.11 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
61d14ba0169712ae35cbb159d8917d21d52bd4e06ceba6b9d22e84b492137a75
BLAKE2b-256 checksum
How to use checksums
850add481fe733234b8ae33f90224637e5cf02771e39352a19d082990db61d63
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.11.16-cp310-cp310-manylinux_2_27_x86_64.whl

Download URL snapy-2.11.16-cp310-cp310-manylinux_2_27_x86_64.whl
Size 63.5 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
ef971249d385e55ebfe360e14b9a47dc98c19f528455e704a12fc09b5e0b3992
BLAKE2b-256 checksum
How to use checksums
4288d5bafc16cacdc57101d8a9a2d22b1a677113ab5114087968bb5b06cb1d7b
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.11.16-cp310-cp310-macosx_15_0_arm64.whl

Download URL snapy-2.11.16-cp310-cp310-macosx_15_0_arm64.whl
Size 4.9 MB
Tags CPython 3.10 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
dcbdba5c9f362633483770905aeef29dbc91f695243b50568c3caee80749c325
BLAKE2b-256 checksum
How to use checksums
b74bda90d75a470ebe301c18375622710aa82ec2ed8bb52cff8d3be4d4cde754
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.11.16

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