Git Product home page Git Product logo

torchswe's Introduction

TorchSWE: GPU shallow-water equation solver

A simple SWE solver on GPU using several different backends, including CuPy, PyTorch, and Legate NumPy. It can also run on CPU through PyTorch, vanilla NumPy, or Legate NumPy.

Installation


Everything is WIP, including documentation. But basically, to install:

$ pip install .

It installs a binary executable called TorchSWE.py to your bin path. Which bin path it installs to depends on your pip.

After installing through pip, only NumPy backend is available. To use other backends, you may need to install them manually. Both PyTorch and CuPy can be found from PyPI and Anaconda. Legate NumPy has to be installed manually currently.

Usage


To see help

$ TorchSWE.py --help

To run a case with vanilla NumPy, go to a case folder and execute:

$ TorchSWE.py ./

To run with CuPy:

$ USE_CUPY=1 TorchSWE.py ./

To run with PyTorch on a GPU:

$ USE_TORCH=1 TorchSWE.py ./

To run with PyTorch on CPU:

$ USE_TORCH=1 TORCH_USE_CPU=1 TorchSWE.py ./

To run with Legate:

$ legate <flags> $(which TorchSWE.py) ./

For Legate, use its flags to control the target hardware. See Legate's documentation. Legate does not know where to find the main Python script of the solver, so we use $(which ...) to provide the full path of TorchSWE.py.

Note


I have a very specific application in mind for this solver, so it's capability is somehow limited. And I intend to keep it simple, instead of generalizing it to general-purpose SWE solver. However, because it's implemented in Python, I believe it's not difficult to apply modifications for other applications.

torchswe's People

Contributors

piyueh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.