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.8-cp313-cp313-manylinux_2_27_x86_64.whl (60.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64

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

Uploaded CPython 3.13macOS 15.0+ ARM64

snapy-2.10.8-cp312-cp312-manylinux_2_27_x86_64.whl (60.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

snapy-2.10.8-cp311-cp311-manylinux_2_27_x86_64.whl (60.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64

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

Uploaded CPython 3.11macOS 15.0+ ARM64

snapy-2.10.8-cp310-cp310-manylinux_2_27_x86_64.whl (60.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64

snapy-2.10.8-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.8-cp313-cp313-manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for snapy-2.10.8-cp313-cp313-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 6dcebcb2cb9f59421c5f2c347af04052dbb3150f6c735c3603c40414da0d92a9
MD5 63d6b6480117e82f2f84e812d8c7ac23
BLAKE2b-256 4fb76442196482125b4d4c8663e50325595211096a05834555c85c8212209670

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.10.8-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 2e684538c27dfeeda450fbb564bece3802906fa9e702ab0fc5c651bb12b4443d
MD5 859e3785bd3e786b707560635794db57
BLAKE2b-256 62c0d59059a0b5849d1553cbaf287ec65fce9f5bf7f7c49133a8f25a3913e46c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.10.8-cp312-cp312-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 98616e6f5e215a63a9c0cfffa1103bb5191288b7d660e22c27b9097ee30a8934
MD5 aee84531dfe97d667f601681f4982242
BLAKE2b-256 3b25feaff7eb083e43f956dd5bf1202138874c57f2f50f9dfb6c59179b61bebf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.10.8-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 b9b2f07ac8773c6b15621f4d3f4547c6442be05515b979bc4ae15df1db77b742
MD5 40f1a1d348b1bfe23dc68cd49800c5da
BLAKE2b-256 e687911632fb059c55c340a38109621a8ce7d274ad18b0262ef6ef09ae065e43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.10.8-cp311-cp311-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 bd64707d3cf20b59ad98c842aa036ffcf091d41d061c36d232c4f3eef743f4f3
MD5 23e48958a86e791642ac547aa579496a
BLAKE2b-256 0c7b3b932a6c92120aac86ade95d07c6dba060e154bc7ab70c47df9de8e26aaa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.10.8-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ab4a9ea071763a8d314fae4d1b42ec21927f3e17b8cfa11e04e6c43aba4fdf24
MD5 fd98dad5a124e608bba69766b1d1fda2
BLAKE2b-256 1499607e36cba91a7862d038a3a0c755636faefcd960910560fd996f447fd699

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.10.8-cp310-cp310-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 8a9943b0f755987a66885faf15d7cf74d6287070a344932340642faceb919e4b
MD5 e03991ed15ccb6f223e6298b9ce6ad18
BLAKE2b-256 fab7661357f845b7307e3a765ecdbee4b65278813ac299003139de84dd8424fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snapy-2.10.8-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 d004cf73f6b636b2cfc448355fb96afabd96f513a1c51525b1db147a8f3bffdb
MD5 183ae245e1c4d62452b946bf03d22040
BLAKE2b-256 6179c6d4532ba85c6b546181de597e157157ad5ff8918af4d0904868ebe3c071

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.10.8 This release

8 files

2.10.7

8 files

2.10.5

8 files

2.10.3

4 files

2.10.2

8 files

2.10.0

8 files

2.9.5

8 files

2.9.2

8 files

2.8.9

8 files

2.8.7

4 files

2.8.6

4 files

2.8.5

4 files

2.8.4

4 files

2.8.1

8 files

2.7.5

4 files

2.7.4

6 files

2.7.2

6 files

2.6.4

8 files

2.6.3

8 files

2.5.5

8 files

2.5.4

8 files

2.4.6

8 files

2.4.5

8 files

2.3.1

8 files

2.2.0

8 files

2.1.4

10 files

1.4.1

8 files

1.3.8

1 file

1.2.9

10 files

1.2.1

10 files

1.1.8

10 files

1.1.5

10 files

1.0.2

6 files

1.0.1

5 files

1.0.0

10 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