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 >= 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:

  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

Release files for snapy 2.10.9

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

Total release size: 260.9 MB

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

Download URL snapy-2.10.9-cp313-cp313-manylinux_2_27_x86_64.whl
Size 60.8 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
3529fdb5ddd29e8715e61b1fc12fb6b4c8e17d0cb2c0562678f4dbb45628149d
BLAKE2b-256 checksum
How to use checksums
75d00f597617abc4d0e628918450a58189f82916ca0d5fe601ca9387313e9699
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.9-cp313-cp313-macosx_15_0_arm64.whl

Download URL snapy-2.10.9-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
217115ce4c95aced281e26c4726cce451841b7fd5867d16fd9fbb8c58ee96a97
BLAKE2b-256 checksum
How to use checksums
1b14ac989a8d68fd5634babeead1f010b45b8d42e39db3daa6449a6f47984ad3
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.9-cp312-cp312-manylinux_2_27_x86_64.whl

Download URL snapy-2.10.9-cp312-cp312-manylinux_2_27_x86_64.whl
Size 60.8 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
348237a4bc256940c4f2060dc06c6b473d140835d4134c1c3375d5da8e89f8d4
BLAKE2b-256 checksum
How to use checksums
106191f8ddabe7391f043d41481cf96e1100b8a726c6155f3d93f0a806440396
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.9-cp312-cp312-macosx_15_0_arm64.whl

Download URL snapy-2.10.9-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
5247fc60d8f331f14ac2eed547b5de4f0512be1e1e20dbb82166eaa9333f558b
BLAKE2b-256 checksum
How to use checksums
8939367f08d3f8e877c8a825f15596b6af2a3b7d62bb32b9aa31be16010e0586
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.9-cp311-cp311-manylinux_2_27_x86_64.whl

Download URL snapy-2.10.9-cp311-cp311-manylinux_2_27_x86_64.whl
Size 60.5 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
18f55592d5f8b1f1f66f9f34a912fc46950166463018bacc3a58ed74820d9d50
BLAKE2b-256 checksum
How to use checksums
b4701026b9e8cdfd3326d89ef484774046e340531bde921c218d55c95a9bdf69
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.9-cp311-cp311-macosx_15_0_arm64.whl

Download URL snapy-2.10.9-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
5ee15088d9b534ec58670ca8f23ee046b8721b702b4345d5abe4fc555a94c09a
BLAKE2b-256 checksum
How to use checksums
f8f2eabce156536a566dbabc015bad788b6437fe625926bace3572a0f7e7eae7
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.9-cp310-cp310-manylinux_2_27_x86_64.whl

Download URL snapy-2.10.9-cp310-cp310-manylinux_2_27_x86_64.whl
Size 60.3 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
94c56142f888c0c560d7671d16d6cc426990007d57b953d609071d42050c13ed
BLAKE2b-256 checksum
How to use checksums
5a2af9c4c1a545052e1af3136143ce2d00153a7c535669df1d3dd7b338ffcc22
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.9-cp310-cp310-macosx_15_0_arm64.whl

Download URL snapy-2.10.9-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
39da4f8303e3a0e57aa28f7dcca404c8c634a701a91c28276d88b100b65f10f8
BLAKE2b-256 checksum
How to use checksums
7d63c81ad21de8dd0040a365ba6a71d89421b8a4b6016f40dd793f904ff8bde1
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.10.9 This release

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