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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

snapy-2.10.2-cp313-cp313-manylinux_2_27_x86_64.whl (60.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64

snapy-2.10.2-cp313-cp313-macosx_15_0_arm64.whl (4.6 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

snapy-2.10.2-cp312-cp312-manylinux_2_27_x86_64.whl (60.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64

snapy-2.10.2-cp312-cp312-macosx_15_0_arm64.whl (4.6 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

snapy-2.10.2-cp311-cp311-manylinux_2_27_x86_64.whl (60.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64

snapy-2.10.2-cp311-cp311-macosx_15_0_arm64.whl (4.6 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

snapy-2.10.2-cp310-cp310-manylinux_2_27_x86_64.whl (60.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64

snapy-2.10.2-cp310-cp310-macosx_15_0_arm64.whl (4.6 MB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

File details

Details for the file snapy-2.10.2-cp313-cp313-manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for snapy-2.10.2-cp313-cp313-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 ae93fd083b0db9bae63d08d2440465191cc41a5d922cb1b0053f67842d7e85d6
MD5 f445846fe5eb5a3a89c4cc47af4f0628
BLAKE2b-256 1fd86fe474161495ee12bebee1b98c2bc84a4de180c205795e0231a16f7452ac

See more details on using hashes here.

File details

Details for the file snapy-2.10.2-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for snapy-2.10.2-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 cc7c849a31bf73c74bb4d1a145c1f299ed059ada44a29e40a9bc5304e86189ea
MD5 760d756e482dc49dffbb9ad5fe6b4261
BLAKE2b-256 853120c97742b12eeb0fb2be180fbbf539ecf28ea45718991b315ca4469e7934

See more details on using hashes here.

File details

Details for the file snapy-2.10.2-cp312-cp312-manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for snapy-2.10.2-cp312-cp312-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 a36145ccc20de50fee9fb7a4c7533e3fe47f9bde3efd3fb9ccd7fcc721051606
MD5 c66a2f7449812b255b0a5fae5eafdfcd
BLAKE2b-256 5c6222729a5d12f2bf751cae9251f798558816eb885490f7702f0d6065cdfc0e

See more details on using hashes here.

File details

Details for the file snapy-2.10.2-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for snapy-2.10.2-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 4607854453cf8869720e31e38870e3c035dff16a3ef5074b3902e3e6f024d79c
MD5 3bf7ca31895160f79d7b939da97fbfbf
BLAKE2b-256 a93581e08950f5bb67a97d4f58c58dc46994be81b444d97088dc107873f75ddb

See more details on using hashes here.

File details

Details for the file snapy-2.10.2-cp311-cp311-manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for snapy-2.10.2-cp311-cp311-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 d3f27b6385c2418cfc8e0d37c93ec33ef62e01f2caf742460abc9081bb73340d
MD5 fa2b3f6ed9b1db8103354351ed29f96f
BLAKE2b-256 c83997e5fc991209174412b6ea486c34a060741e210ce3e8c1c5d9e45bbb4771

See more details on using hashes here.

File details

Details for the file snapy-2.10.2-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for snapy-2.10.2-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 5ad640091b4751b5267fb0a4cf2ec7ccc534ea8f1a0e75ce9fcfbbf0dba54a1e
MD5 45a4d89defcd6673c61575b5cecc8a68
BLAKE2b-256 aeeeefdea56711363ade5f149624f52d8f62002819711469730e5e4628ee826e

See more details on using hashes here.

File details

Details for the file snapy-2.10.2-cp310-cp310-manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for snapy-2.10.2-cp310-cp310-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 e976d3f42fe89b5ba05a9452c87ff6f539c3ca30cd4ea436d128b0aa6ca26b75
MD5 09d2757f45fec6a424c0a8a158d554d5
BLAKE2b-256 26e032799b13084fe0362721af2794a22a3678dd7322590a750b30c5a6904bb7

See more details on using hashes here.

File details

Details for the file snapy-2.10.2-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for snapy-2.10.2-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 29f7556d0e85d9072b414de4facd7db9d155cc3de0517b1bc2eea35b425219a5
MD5 87aedef47a947ebe5178c505e79fae1b
BLAKE2b-256 67b0d11059ca3fa27c686deba6cd88ee2cd51d16f76adf6dc027444f8f3d5d47

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page