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

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

Download URL snapy-2.11.0-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
d142c03e3ffe8dd2f546c03eeda471e0f0aa1433dcd6726512df0c786ac114c5
BLAKE2b-256 checksum
How to use checksums
7e8c6ae5477004d61a6b5989134acc571ea6cad7b4dbedf86a4ef539d8c3dd9b
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.0-cp313-cp313-macosx_15_0_arm64.whl

Download URL snapy-2.11.0-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
40e6c285111dcca0bc122ad4d25c1dbc4441441073c8b68249da3f07b45f5cec
BLAKE2b-256 checksum
How to use checksums
839b1180697babeeda232c3b17113ad633badba426991addc8aece895461da18
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.0-cp312-cp312-manylinux_2_27_x86_64.whl

Download URL snapy-2.11.0-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
f10a93106b1588e963c0b6335b7448f24d3059916286d8e6771b8ffc64b9d384
BLAKE2b-256 checksum
How to use checksums
d1132f1cd60474aca0328b36ac6cbf52f25b02dd6aa618cbe4beacc7874a60da
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.0-cp312-cp312-macosx_15_0_arm64.whl

Download URL snapy-2.11.0-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
743dfd39672719189ba72d7ffddc003c6120167d5706ba17861ff247ea7e004d
BLAKE2b-256 checksum
How to use checksums
236b3a88f7f58ede4a50b281c6bd6ece0e0b10b0fd465c2338584e630a64d7f5
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.0-cp311-cp311-manylinux_2_27_x86_64.whl

Download URL snapy-2.11.0-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
51b892a3589c2635d8e6a5d877cef535cc70ffffa5f82e5d0d39164b9af47a31
BLAKE2b-256 checksum
How to use checksums
6e1fbd3d4147b70002b89d1d6005dc185843ef437596f0ce7fa89d2dd6f674d1
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.0-cp311-cp311-macosx_15_0_arm64.whl

Download URL snapy-2.11.0-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
c7446ea4eab3d11c92c2dc48bbdadda22d879abc05551fa1c4d54a3548c449a5
BLAKE2b-256 checksum
How to use checksums
33eda81110304c5bad11e747a803a67e2b472581c7327d25bfb218d8d44f1268
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.0-cp310-cp310-manylinux_2_27_x86_64.whl

Download URL snapy-2.11.0-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
6e743b0b26d9efddf932b6fcf59a4b9822cb1c25191e65151cda285c4b84d352
BLAKE2b-256 checksum
How to use checksums
bcbab48df906916da07b1bfe737cee6eac3478332bc99bd5f293f7871efb8c6e
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.0-cp310-cp310-macosx_15_0_arm64.whl

Download URL snapy-2.11.0-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
d7dcc48c6884cb59cbaecc2fa1eeb1d688cf1b24213227cfbc7f2b74eac31962
BLAKE2b-256 checksum
How to use checksums
159cdabc8225e1103dc886c0f8d52f7d3765bec098fadce711c1732171e98050
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.0 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