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.
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:
- Clone the repository:
git clone https://github.com/chengcli/snapy.git
cd snapy
- Install dependencies:
pip install numpy kintera torch==2.7.1
- Install NetCDF:
- Linux (Ubuntu/Debian):
sudo apt-get install libnetcdf-dev
- macOS:
brew install netcdf
- Linux (Ubuntu/Debian):
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.
- Configure and build:
cmake -B build -DCMAKE_BUILD_TYPE=Release -DNETCDF=ON
cmake --build build --parallel 3
- Install the Python package:
pip install .
Examples
The examples/ directory contains several working examples:
Python Examples:
shock.py- Sod shock tube with internal boundarystraka.py- Straka cold bubble convection testrobert.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
- Author: Cheng Li
- Email: chengcli@umich.edu
- GitHub: https://github.com/chengcli/snapy
Metadata
Release files for snapy 2.10.36
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| snapy-2.10.36-cp313-cp313-manylinux_2_27_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.27+ x86-64 | Details |
| snapy-2.10.36-cp313-cp313-macosx_15_0_arm64.whl | CPython 3.13 | CPython 3.13 | macOS 15.0+ ARM64 | Details |
| snapy-2.10.36-cp312-cp312-manylinux_2_27_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.27+ x86-64 | Details |
| snapy-2.10.36-cp312-cp312-macosx_15_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 15.0+ ARM64 | Details |
| snapy-2.10.36-cp311-cp311-manylinux_2_27_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.27+ x86-64 | Details |
| snapy-2.10.36-cp311-cp311-macosx_15_0_arm64.whl | CPython 3.11 | CPython 3.11 | macOS 15.0+ ARM64 | Details |
| snapy-2.10.36-cp310-cp310-manylinux_2_27_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.27+ x86-64 | Details |
| snapy-2.10.36-cp310-cp310-macosx_15_0_arm64.whl | CPython 3.10 | CPython 3.10 | macOS 15.0+ ARM64 | Details |
Total release size: 266.1 MB
Release files / snapy-2.10.36-cp313-cp313-manylinux_2_27_x86_64.whl
| Download URL | snapy-2.10.36-cp313-cp313-manylinux_2_27_x86_64.whl |
|---|---|
| Size | 61.9 MB |
| Tags | CPython 3.13 Linux glibc 2.27+ x86-64 |
|
SHA-256 checksum How to use checksums |
c5cf5cb524074c95973622168166e4744c49cc440a876621a3715fc900c3cbff
|
|
BLAKE2b-256 checksum How to use checksums |
3f9aca9a30af2223397fbff02b173e160b8e540359bfff4c67f35f917132a73a
|
| 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.10.36-cp313-cp313-macosx_15_0_arm64.whl
| Download URL | snapy-2.10.36-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 |
e154d7c0f9ccd1b99cf94d336259817f5141a5029fc673f4d3fa662f9542d6e3
|
|
BLAKE2b-256 checksum How to use checksums |
02981587894fcfcd00cb6f474fd4dcd8a6b7525da85b07bd3f3086c7fbee2c9c
|
| 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.10.36-cp312-cp312-manylinux_2_27_x86_64.whl
| Download URL | snapy-2.10.36-cp312-cp312-manylinux_2_27_x86_64.whl |
|---|---|
| Size | 61.9 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 |
|
SHA-256 checksum How to use checksums |
63478264eef37f163bdcb7dacde520856f1e0f233b903fe1a4ff09b5677e3500
|
|
BLAKE2b-256 checksum How to use checksums |
38e15cdb0a32bb263739d87d6f3c25b9b64c6a171dce24d90874d42b3be05c3e
|
| 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.10.36-cp312-cp312-macosx_15_0_arm64.whl
| Download URL | snapy-2.10.36-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 |
720ca747e00f1a7f6888933d436f20170ac7b1c714332858f233405d154b8830
|
|
BLAKE2b-256 checksum How to use checksums |
36e7bf7dce99361277570a3be470367e4c98bd03f49652138b662c79b245a1db
|
| 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.10.36-cp311-cp311-manylinux_2_27_x86_64.whl
| Download URL | snapy-2.10.36-cp311-cp311-manylinux_2_27_x86_64.whl |
|---|---|
| Size | 61.7 MB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 |
|
SHA-256 checksum How to use checksums |
967256626a4fdba04b16f3a6608b5cc98884a9af85247f8cf6763045beb45a7d
|
|
BLAKE2b-256 checksum How to use checksums |
a4c5ae22a89811b2986e69890701280888eb009826165b87e309932a16ad1595
|
| 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.10.36-cp311-cp311-macosx_15_0_arm64.whl
| Download URL | snapy-2.10.36-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 |
86822bb11738a7897800dc382f7fa111b46cc04bf0f5172bccf41578990c32aa
|
|
BLAKE2b-256 checksum How to use checksums |
f78c1b9704f7400b2aac7a0a1ceacdc142d0664e403d6b910176e7aca1debdd0
|
| 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.10.36-cp310-cp310-manylinux_2_27_x86_64.whl
| Download URL | snapy-2.10.36-cp310-cp310-manylinux_2_27_x86_64.whl |
|---|---|
| Size | 61.5 MB |
| Tags | CPython 3.10 Linux glibc 2.27+ x86-64 |
|
SHA-256 checksum How to use checksums |
e705f678082439b5b67865b7d7188e9b69d2c8eee98240b84c20a95a7c812dd2
|
|
BLAKE2b-256 checksum How to use checksums |
02944c061e320d7b4dc90a830a5e5f867c7986a98f9ca9d9c7ae9098e5ff6da8
|
| 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.10.36-cp310-cp310-macosx_15_0_arm64.whl
| Download URL | snapy-2.10.36-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 |
0da019da3948ee058d8f42a0d7daa176602e3e79821122cc174f385dc6bf75c3
|
|
BLAKE2b-256 checksum How to use checksums |
558b4ea6d36ad6e2368bff22d850c76816d3d4eb86eb03f573cae43f61a9c300
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|