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.11.2
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.11.2-cp313-cp313-manylinux_2_27_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.27+ x86-64 | Details |
| snapy-2.11.2-cp313-cp313-macosx_15_0_arm64.whl | CPython 3.13 | CPython 3.13 | macOS 15.0+ ARM64 | Details |
| snapy-2.11.2-cp312-cp312-manylinux_2_27_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.27+ x86-64 | Details |
| snapy-2.11.2-cp312-cp312-macosx_15_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 15.0+ ARM64 | Details |
| snapy-2.11.2-cp311-cp311-manylinux_2_27_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.27+ x86-64 | Details |
| snapy-2.11.2-cp311-cp311-macosx_15_0_arm64.whl | CPython 3.11 | CPython 3.11 | macOS 15.0+ ARM64 | Details |
| snapy-2.11.2-cp310-cp310-manylinux_2_27_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.27+ x86-64 | Details |
| snapy-2.11.2-cp310-cp310-macosx_15_0_arm64.whl | CPython 3.10 | CPython 3.10 | macOS 15.0+ ARM64 | Details |
Total release size: 268.2 MB
Release files / snapy-2.11.2-cp313-cp313-manylinux_2_27_x86_64.whl
| Download URL | snapy-2.11.2-cp313-cp313-manylinux_2_27_x86_64.whl |
|---|---|
| Size | 62.4 MB |
| Tags | CPython 3.13 Linux glibc 2.27+ x86-64 |
|
SHA-256 checksum How to use checksums |
e9d7cb7f161be2b0e13fc75624d722e147afba805838424d7e4e3f9d5f3cef6c
|
|
BLAKE2b-256 checksum How to use checksums |
b5aa7d68b29966310de566fcbcd51e7b600c1e1499199ea03cc484fa62dea6ee
|
| 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.2-cp313-cp313-macosx_15_0_arm64.whl
| Download URL | snapy-2.11.2-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 |
27be9fe5938dd57c148e93a18597d54135918ce617d82a41b6ebfc13ae3a3e3c
|
|
BLAKE2b-256 checksum How to use checksums |
8249e85db6699aa496e84007da4fc5dbf3768460487df1efe3bcb05eb221f2bb
|
| 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.2-cp312-cp312-manylinux_2_27_x86_64.whl
| Download URL | snapy-2.11.2-cp312-cp312-manylinux_2_27_x86_64.whl |
|---|---|
| Size | 62.4 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 |
|
SHA-256 checksum How to use checksums |
5e7cced9e71c6b957d35c97a7f43d471d139d0142600820b0f72a8b6d7961362
|
|
BLAKE2b-256 checksum How to use checksums |
d17915efcb3d11c595a4f43698e0662281a34fafa19033ab84f431664f73c04e
|
| 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.2-cp312-cp312-macosx_15_0_arm64.whl
| Download URL | snapy-2.11.2-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 |
05ceb424b0721ed45adfd6f42073918765cae1726dc7fe391cf3959b41578787
|
|
BLAKE2b-256 checksum How to use checksums |
ed7748f3f7bb62b6dc3f27422aebb05b38383ebc1aec601b8e981f0e7d568ea9
|
| 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.2-cp311-cp311-manylinux_2_27_x86_64.whl
| Download URL | snapy-2.11.2-cp311-cp311-manylinux_2_27_x86_64.whl |
|---|---|
| Size | 62.2 MB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 |
|
SHA-256 checksum How to use checksums |
78c40196b82c5548df42ce867006a8cb1628dd95aee2789fc2befe065f92e9b5
|
|
BLAKE2b-256 checksum How to use checksums |
f202fa59bced9a388964b7b0e5c3025c6881a53c23bb3eefce33f38df645a46d
|
| 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.2-cp311-cp311-macosx_15_0_arm64.whl
| Download URL | snapy-2.11.2-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 |
cba39307136783a3ff966fd6810394bb5828616388be50811ea5d9e9f20151a5
|
|
BLAKE2b-256 checksum How to use checksums |
7c275dbb637f6bc3fab3ee4d8b97f2ff8fcdcc332e746bef8331cc8a11345fbc
|
| 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.2-cp310-cp310-manylinux_2_27_x86_64.whl
| Download URL | snapy-2.11.2-cp310-cp310-manylinux_2_27_x86_64.whl |
|---|---|
| Size | 62.0 MB |
| Tags | CPython 3.10 Linux glibc 2.27+ x86-64 |
|
SHA-256 checksum How to use checksums |
977d9d5d5f23236f7f2fe3e598f3b3e8f78b52e52bac1a4da54367b50a9d1793
|
|
BLAKE2b-256 checksum How to use checksums |
2a799d07d011a55eb56510cac1a7f3ea97e15637080da002efdf0b322fe5e8f0
|
| 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.2-cp310-cp310-macosx_15_0_arm64.whl
| Download URL | snapy-2.11.2-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 |
1fec2ecd7b08e51fe0d63a2bc45cc6107490491094c771b5368bb381fa881f66
|
|
BLAKE2b-256 checksum How to use checksums |
898b705bfdbacfe927b266dd458450b9935b8d524667a5c244e99fb67bd010b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|