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 >= 1.1.5
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 >= 1.1.5
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
Release files for snapy 2.10.7
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.7-cp313-cp313-manylinux_2_27_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.27+ x86-64 | Details |
| snapy-2.10.7-cp313-cp313-macosx_15_0_arm64.whl | CPython 3.13 | CPython 3.13 | macOS 15.0+ ARM64 | Details |
| snapy-2.10.7-cp312-cp312-manylinux_2_27_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.27+ x86-64 | Details |
| snapy-2.10.7-cp312-cp312-macosx_15_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 15.0+ ARM64 | Details |
| snapy-2.10.7-cp311-cp311-manylinux_2_27_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.27+ x86-64 | Details |
| snapy-2.10.7-cp311-cp311-macosx_15_0_arm64.whl | CPython 3.11 | CPython 3.11 | macOS 15.0+ ARM64 | Details |
| snapy-2.10.7-cp310-cp310-manylinux_2_27_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.27+ x86-64 | Details |
| snapy-2.10.7-cp310-cp310-macosx_15_0_arm64.whl | CPython 3.10 | CPython 3.10 | macOS 15.0+ ARM64 | Details |
Total release size:260.2 MB
Release files / snapy-2.10.7-cp313-cp313-manylinux_2_27_x86_64.whl
| Download URL | snapy-2.10.7-cp313-cp313-manylinux_2_27_x86_64.whl |
|---|---|
| Size | 60.6 MB |
| Tags | CPython 3.13 Linux glibc 2.27+ x86-64 |
|
SHA-256 checksum How to use checksums |
de804603eae539e7e71dc1557b1e992f60f31a3f4f5d161b2067321d164f6c91
|
|
BLAKE2b-256 checksum How to use checksums |
4f1a4592c455c8f4bbadaa2031468fe419c430293d786dbfa446c8cfe355c9a1
|
| 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.7-cp313-cp313-macosx_15_0_arm64.whl
| Download URL | snapy-2.10.7-cp313-cp313-macosx_15_0_arm64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.13 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c60f2e9f95bfa463d5091b51fd4ed320131f520fe9dd0ccd8ad56a4e0c33b080
|
|
BLAKE2b-256 checksum How to use checksums |
1bd9d7fdd0058062048dc1a4526f2f1bc7876d5696792cdc07e31c1b695e1bce
|
| 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.7-cp312-cp312-manylinux_2_27_x86_64.whl
| Download URL | snapy-2.10.7-cp312-cp312-manylinux_2_27_x86_64.whl |
|---|---|
| Size | 60.6 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 |
|
SHA-256 checksum How to use checksums |
f4aca2af540941a445a1970abbbb118980390342cd355efb9cb8d4d5f26531c6
|
|
BLAKE2b-256 checksum How to use checksums |
88b8c15e4fe8f1e0a5f562e2480697e037cff522f999a49a30ffe88e90904188
|
| 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.7-cp312-cp312-macosx_15_0_arm64.whl
| Download URL | snapy-2.10.7-cp312-cp312-macosx_15_0_arm64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.12 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
01f3c3d86da98f63ea37670e2223def2741dbae8348ff038601a993d319fb191
|
|
BLAKE2b-256 checksum How to use checksums |
d38d47b6cf70cb2a928723896d3eea4d34cf7f19d6c634cb27b5b3fec7bf04e4
|
| 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.7-cp311-cp311-manylinux_2_27_x86_64.whl
| Download URL | snapy-2.10.7-cp311-cp311-manylinux_2_27_x86_64.whl |
|---|---|
| Size | 60.4 MB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 |
|
SHA-256 checksum How to use checksums |
789648eaf81e1312521f9db449eb5036efaed76cc1e3c09a4366f33f014531b2
|
|
BLAKE2b-256 checksum How to use checksums |
f4fd07c17da338f590131ddead3369344d0f180e792f97f1dc4d4525674deefd
|
| 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.7-cp311-cp311-macosx_15_0_arm64.whl
| Download URL | snapy-2.10.7-cp311-cp311-macosx_15_0_arm64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.11 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d191c78736ec2b4cca815a9f57cd6087466d15deaa69a815e4817b4c17dc9b2e
|
|
BLAKE2b-256 checksum How to use checksums |
78998590340d1ee58bbcf05b61efd4799e4fe19a012a66797508271e7ad11c68
|
| 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.7-cp310-cp310-manylinux_2_27_x86_64.whl
| Download URL | snapy-2.10.7-cp310-cp310-manylinux_2_27_x86_64.whl |
|---|---|
| Size | 60.2 MB |
| Tags | CPython 3.10 Linux glibc 2.27+ x86-64 |
|
SHA-256 checksum How to use checksums |
2bf1aad2f52715086ec40c0071d8ba535fea7e456ecef58b300a84a20be6b377
|
|
BLAKE2b-256 checksum How to use checksums |
47ef1d637748efdc209e58bc6f34868ba512760844a8fc0dba0b639abcebb873
|
| 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.7-cp310-cp310-macosx_15_0_arm64.whl
| Download URL | snapy-2.10.7-cp310-cp310-macosx_15_0_arm64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.10 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9021e4c84595829b69ee048fe06e36c15d6173390e86e376d315714a486a4958
|
|
BLAKE2b-256 checksum How to use checksums |
9cb2f283441b0fbf851f173496cf989d039a6861600ea90e9df3aa0b0ef85b7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|