Skip to main content

FastFlowX

A library to accelerate flow and depression routing for terrains on the GPU.

FastFlowX ships a PyTorch CUDA extension that is compiled from source on your machine at install time. This repository is the maintained release of FastFlow (2024). The code released with that paper lives at landscapes/fastflow and is kept as-is for reproducing the paper; FastFlowX extends it with API improvements and the additional functions developed for Pixels2Peaks (2026). See docs/API.md for the full API.

Requirements

You must have all of these in your environment before installing FastFlow:

  • An NVIDIA GPU + driver
  • A CUDA toolkit (nvcc) matching your PyTorch build (e.g. CUDA 12.4)
  • A C++ compiler (GCC/Clang on Linux, MSVC on Windows)
  • PyTorch. FastFlow compiles against whichever torch you already have.

Tested on: Debian 11 (Linux 5.10), Python 3.9.23, PyTorch 2.4.1, CUDA 12.4 (nvcc 12.2), NVIDIA H100 NVL.

Installation

pip install "setuptools>=77" wheel ninja
pip install fastflowx --no-build-isolation

Or from a local checkout: pip install --no-build-isolation .

--no-build-isolation lets the build compile against your existing PyTorch, but it also stops pip from installing build tools, hence the first command. ninja is optional; it only makes the compile ~9x faster.

Or use the provided conda environment, which brings its own Python, PyTorch and build tools:

conda env create -f environment.yml
conda activate fastflow
pip install fastflowx --no-build-isolation

Usage

import torch
import fastflow as ff

z = torch.rand(512, 512, device="cuda") * 1000.0

filled = ff.fill_depressions(z)          # pit-free surface
area   = ff.drainage_area(z, dx=30.0)    # drainage area

See docs/API.md for the full API and more examples.

Tests

The extension is compiled on your machine, so it is worth checking the build:

python -c "import torch, fastflow; print(fastflow.drainage_area(torch.rand(64, 64, device='cuda')).shape)"

The full suite (imports, the invariant sweep up to 4096x4096, and the benchmarks) needs pytest and a CUDA device:

pip install pytest
pytest

The timing sweep also runs on its own:

python tests/test_benchmark.py --sizes 512 1024 2048 --iters 50

Citation

If you use this library, please cite FastFlow:

@article{jain2024fastflow,
  title={FastFlow: GPU Acceleration of Flow and Depression Routing for Landscape Simulation},
  author={Jain, Aryamaan and Kerbl, Bernhard and Gain, James and Finley, Brandon and Cordonnier, Guillaume},
  journal={Computer Graphics Forum},
  volume={43},
  number={7},
  year={2024},
}

The API improvements and additional functions in this release were developed for:

@article{jain2026pixels2peaks,
  title={Pixels2Peaks: Converting Terrain Images to Heightmaps},
  author={Jain, Aryamaan and Gain, James and Cordonnier, Guillaume},
  journal={ACM Transactions on Graphics},
  volume={45},
  number={4},
  year={2026}
}

Download files

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

Source Distribution

fastflowx-0.1.0.tar.gz (33.4 kB view details)

Uploaded Source

File details

Details for the file fastflowx-0.1.0.tar.gz.

File metadata

  • Download URL: fastflowx-0.1.0.tar.gz
  • Upload date:
  • Size: 33.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for fastflowx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e88bff871f6881b15b2b6c698e8a6968e273334e123e95455dae43e6eee48129
MD5 95076d1db60dfb06de8ed68520c0999c
BLAKE2b-256 5db648b39f53b1bb10c157b5e684833c442c73b64ffbf8c423b36986dde79112

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