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.7.x
  • NumPy
  • kintera >= 2.5.13

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.7.x with C++ libraries
  • NetCDF C library
  • kintera >= 2.5.13

Build steps:

  1. Clone the repository:
git clone https://github.com/chengcli/snapy.git
cd snapy
  1. Install dependencies:
pip install numpy kintera torch==2.7.1
  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.

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

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

Total release size: 266.4 MB

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

Download URL snapy-2.11.1-cp313-cp313-manylinux_2_27_x86_64.whl
Size 62.0 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
93aa615c799687d76d0c7557e6119748033faae19622010fcd8eeb84a42045e6
BLAKE2b-256 checksum
How to use checksums
df0782a2fe9f942fdf261441db5c47dc71882dc167f4ccc2f6360078e46e81e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL snapy-2.11.1-cp313-cp313-macosx_15_0_arm64.whl
Size 4.8 MB
Tags CPython 3.13 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
e5e9da7a1f2a16dedb2cd9774b058a79c2465000a78ce3c5958bb1df40a90778
BLAKE2b-256 checksum
How to use checksums
49996c1bb433320371830c66482e936b0ca46b09b62c6ee8a78f90e43c269a2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL snapy-2.11.1-cp312-cp312-manylinux_2_27_x86_64.whl
Size 62.0 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
369742caf12a5e9cc0a33d257ace03709d5e9d131d6e21e7afe1d9ba9d2af24b
BLAKE2b-256 checksum
How to use checksums
0f07d5089ebe190907b1537a0735c20944751f39e3cd79888e3fa17a4ffd5f88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL snapy-2.11.1-cp312-cp312-macosx_15_0_arm64.whl
Size 4.8 MB
Tags CPython 3.12 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
aa5bc835c097ae6adabe3948a9124fe1914302f901c37be489364c4dce63a45b
BLAKE2b-256 checksum
How to use checksums
15d64cf5860ab1f14ab967e7f3570f269fe03d8bf66f0c8c8223f6541e167c02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL snapy-2.11.1-cp311-cp311-manylinux_2_27_x86_64.whl
Size 61.8 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
9e972dcea0857a029ddc58d096f785814b1ba913983a9bd1f06d3c33cceb4b63
BLAKE2b-256 checksum
How to use checksums
6a94a7e515bc7812429480f0d0cc239de1940a9179ceed5eebd3e01b8a6182c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL snapy-2.11.1-cp311-cp311-macosx_15_0_arm64.whl
Size 4.8 MB
Tags CPython 3.11 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
2c05555f33188d23a2e8f736f19f979c883ee8f3b1e99d2b8b90fb63f66b0520
BLAKE2b-256 checksum
How to use checksums
d7e2283c89c68534bf9f55809b11c0e26c81cd215022d573ba92b9e779a62b1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL snapy-2.11.1-cp310-cp310-manylinux_2_27_x86_64.whl
Size 61.6 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
bfa5f8f6bd1e6b838d0e5b272f02bec070e501fe7515a9a95b7008e56adf7ee2
BLAKE2b-256 checksum
How to use checksums
07a57565c83db110806aa5333eca16955dca85a0027ec06beaf22d5b5a692b7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL snapy-2.11.1-cp310-cp310-macosx_15_0_arm64.whl
Size 4.8 MB
Tags CPython 3.10 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
7c08ca8ba9344a7da1af76b8aa37e29ccde6057de07480e4442a37614eb1e08e
BLAKE2b-256 checksum
How to use checksums
61f85157e5403e14390f715d401644efb6d1a953488f61ca53548b120928009e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

2.11.1 This release

8 release files

2.10.9

8 release files

2.10.8

8 release files

2.10.7

8 release files

2.10.0

8 release files

2.9.5

8 release files

2.9.2

8 release files

2.8.9

8 release files

2.8.7

4 release files

2.8.4

4 release files

2.8.1

8 release files

2.7.5

4 release files

2.6.4

8 release files

2.5.5

8 release files

2.4.6

8 release files

2.3.1

8 release files

2.2.0

8 release files

2.1.4

10 release files

1.4.1

8 release files

1.3.8

1 release file

1.2.9

10 release files

1.0.2

6 release files

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