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

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

Total release size: 271.0 MB

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

Download URL snapy-2.11.5-cp313-cp313-manylinux_2_27_x86_64.whl
Size 63.1 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
dd1ed4993533def9b06a637dde33cd78700b69d1c4f3010a8d44acab39d2557d
BLAKE2b-256 checksum
How to use checksums
c67a4bf4d9f8d7d6ce2b148f66ce72f3a47c0d68b3c124600eb616245a7512b3
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.5-cp313-cp313-macosx_15_0_arm64.whl

Download URL snapy-2.11.5-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
34267879b03caffee23b03f6a178a058448dad654ac5ddf46b045d549fb2ef96
BLAKE2b-256 checksum
How to use checksums
29ea3cc2bdb6bcfe5019aeafb149f3458358ba3577e066b868c1d7308181b4be
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.5-cp312-cp312-manylinux_2_27_x86_64.whl

Download URL snapy-2.11.5-cp312-cp312-manylinux_2_27_x86_64.whl
Size 63.1 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
4e5ebca7b7cdb0dc9b373241ca486c081d99d0edacd29bc22d355eed9a352139
BLAKE2b-256 checksum
How to use checksums
79b66e0f093bf82daa1ccc85e6c3c3819270bc8fb352ec1d5d0cb3ff0e01311a
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.5-cp312-cp312-macosx_15_0_arm64.whl

Download URL snapy-2.11.5-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
36a1dd3b1da95134015c4452600d05db9a2068b127f86375f640361045731539
BLAKE2b-256 checksum
How to use checksums
ad97ecabccd9055a7038b9aec644f6e55cd2045554bbe8f286490dca69088ce7
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.5-cp311-cp311-manylinux_2_27_x86_64.whl

Download URL snapy-2.11.5-cp311-cp311-manylinux_2_27_x86_64.whl
Size 62.9 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
10aaddf49abee29f96f7fe56e4f0f0e8e06579c06565dd0fc1127f966b42222e
BLAKE2b-256 checksum
How to use checksums
ab2c3eee5fb711bffd0868bcb8f49a72aec31d03440ce3387e006d44c0b81fd6
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.5-cp311-cp311-macosx_15_0_arm64.whl

Download URL snapy-2.11.5-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
4bd816225cf8f41895b8979a81d5f2514b2bd04e9982448c7ed15651a0605083
BLAKE2b-256 checksum
How to use checksums
5c48c67a61ee783828bfd6af9528e312482c3d4863ca5386ade19fae9e83cbeb
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.5-cp310-cp310-manylinux_2_27_x86_64.whl

Download URL snapy-2.11.5-cp310-cp310-manylinux_2_27_x86_64.whl
Size 62.7 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
838748afbcd5f5c2596d5fe9b3aa9f1af20b8d43ac90a9a58345e27c73d48bd5
BLAKE2b-256 checksum
How to use checksums
059dd097aea7c4648e88ad710d003764aa8b6780e695bac0d51c157dca69a9be
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.5-cp310-cp310-macosx_15_0_arm64.whl

Download URL snapy-2.11.5-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
06c143ec58a504bc829c4e3c5f98bb2c5f2f275baada378550cdc8fc782e7d3d
BLAKE2b-256 checksum
How to use checksums
cc5a722b426daece58a1393d472ee53b280a6a8888295e7d933e0b9f1e805d1d
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.5 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