Skip to content

Commit

Permalink
Add support for publishing to PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorC committed Mar 2, 2022
1 parent 450e5e1 commit 0f9f5e1
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 49 deletions.
56 changes: 30 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,34 @@ on: [push]
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10' ]
name: Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install MPI
run: |
sudo apt install -y -q mpich libmpich-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip
make install
- name: Lint
run: |
make lint
- name: Type-check
run: |
make type-check
- name: Test
run: |
make coverage
- name: Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install MPI
run: |
sudo apt install -y -q mpich libmpich-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip
make install
- name: Lint
run: |
make lint
- name: Type-check
run: |
make type-check
- name: Test
run: |
make coverage
- name: Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include README.md
include LICENSE
include MANIFEST.in
include requirements.txt
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
setup:
python setup.py install

package:
python setup.py sdist bdist_wheel

publish-test:
python -m twine upload --repository testpypi dist/*

publish:
python -m twine upload dist/*

install:
pip3 install -r requirements.txt

Expand Down
35 changes: 20 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# PararealML [![Build Status](https://github.com/ViktorC/PararealML/actions/workflows/build.yml/badge.svg)](https://github.com/ViktorC/PararealML/actions/workflows/build.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=net.viktorc%3Apararealml&metric=alert_status)](https://sonarcloud.io/dashboard?id=net.viktorc%3Apararealml) [![Docs](https://img.shields.io/badge/docs-latest-blue.svg)](https://pararealml.readthedocs.io/en/latest/index.html) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
# PararealML

[![Build Status](https://github.com/ViktorC/PararealML/actions/workflows/build.yml/badge.svg)](https://github.com/ViktorC/PararealML/actions/workflows/build.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=net.viktorc%3Apararealml&metric=alert_status)](https://sonarcloud.io/dashboard?id=net.viktorc%3Apararealml)
[![PyPI Version](https://badge.fury.io/py/pararealml.svg)](https://badge.fury.io/py/pararealml)
[![Docs](https://img.shields.io/badge/docs-latest-blue.svg)](https://pararealml.readthedocs.io/en/latest/index.html)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

PararealML is a differential equation solver library featuring a [Parareal](https://en.wikipedia.org/wiki/Parareal) framework based on a unified interface for initial value problems and various solvers including a number of machine learning accelerated ones. The library's main purpose is to provide a toolset to investigate the properties of the Parareal algorithm, especially when using machine learning accelerated coarse operators, across various problems. The library's implementation of the Parareal algorithm uses [MPI](https://en.wikipedia.org/wiki/Message_Passing_Interface) via [mpi4py](https://mpi4py.readthedocs.io/en/stable/).

## Main components
The library has a modular design to allow for easy extensibility. The main components that enable this are described below.

<img src="https://user-images.githubusercontent.com/12938964/156269280-58213998-58c2-45f1-aabb-7441ac4aa33e.png" alt="pararealml"/>

### Differential equation
Differential equations extend the `DifferentialEquation` base class. In PararealML, all differential equations are time-dependent. Moreover, the unknown variables of differential equations are by definition vector-valued to support systems of differential equations. Both ordinary and partial differential equations are supported.

Expand Down Expand Up @@ -81,31 +89,28 @@ Visualizing the solutions of differential equations is supported by PararealML t

A few examples of plots generated by PararealML can be seen below.

<p float="left">
<p>
<img src="https://user-images.githubusercontent.com/12938964/152646803-e044c86c-f631-4cf6-9f6b-d9efdb6ae8df.png" alt="lorenz" width="400"/>
<img src="https://user-images.githubusercontent.com/12938964/152624090-cab353b4-0fe4-4d19-b9d0-71c9ff9103f5.png" alt="lorenz phase space" width="400"/>
</p>
<p float="left">
<p>
<img src="https://user-images.githubusercontent.com/12938964/153720536-b4c22dc8-d112-4331-bcc5-130c22a36199.gif" alt="n-body" width="400"/>
<img src="https://user-images.githubusercontent.com/12938964/152625732-f177fe9b-9184-404b-8737-79411e9ea7e3.gif" alt="wave 2d surface" width="400"/>
</p>
<p float="left">
<p>
<img src="https://user-images.githubusercontent.com/12938964/152646506-1404a822-dbc9-481e-91ec-b1e6b5a49748.gif" alt="cahn hilliard 3d" width="400"/>
<img src="https://user-images.githubusercontent.com/12938964/152649580-ced02c20-b95f-4ec2-bd81-d3e34b13f9a5.gif" alt="navier stokes stream" width="400"/>
</p>

## Examples
The [examples](https://git.ecdf.ed.ac.uk/msc-19-20/s1984842/tree/master/code/python/examples) folder contains a range of different examples of using the library for solving various differential equations both in serial and parallel. The scripts also include examples of using machine learning operators.

## Setup
To use the Parareal operator, an implementation of the MPI standard must be installed and the `mpicc` program must be on the search path as per the [installation guide](https://mpi4py.readthedocs.io/en/stable/install.html#using-pip) of mpi4py. With that set up, the dependencies of the library may be installed by running `make install`.

## Testing
To perform linting, execute `make lint`.

The library uses type-hints throughout. For type checking, use the command `make type-check`.

To run the unit tests, execute `make test`.
## Installation
To install PararealML, an implementation of the MPI standard must be pre-installed and the `mpicc` program must be on the search path as per the [installation guide](https://mpi4py.readthedocs.io/en/stable/install.html#using-pip) of mpi4py. With that set up, the library can be installed by running `pip install pararealml`.

## Running
To run any of the examples from the [examples](https://git.ecdf.ed.ac.uk/msc-19-20/s1984842/tree/master/code/python/examples) folder using an arbitrary number of MPI processes, run `make run p={number of processes} example={name of example file without extension}` (e.g. `make run p=4 example=lorenz_parareal`).
## Development
* To install the dependencies of the library, run `make install` (this requires an existing MPI installation and `mpicc`).
* To perform linting, execute `make lint`.
* The library uses type-hints throughout. For type checking, use the command `make type-check`.
* To run the unit tests, execute `make test`.
* To run any of the examples from the [examples](https://git.ecdf.ed.ac.uk/msc-19-20/s1984842/tree/master/code/python/examples) folder using an arbitrary number of MPI processes, run `make run p={number of processes} example={name of example file without extension}` (e.g. `make run p=4 example=lorenz_parareal`).
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[metadata]
description_file = README.md
long_description = file: README.md
long_description_content_type = text/markdown
45 changes: 38 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,45 @@
from setuptools import setup, find_packages

setup(
name='PararealML',
version='0.0.1',
description='A parallel-in-time differential equation solver framework '
'with machine learning acceleration',
name='pararealml',
version='0.1.0',
description='A machine learning boosted parallel-in-time differential '
'equation solver framework',
url='https://github.com/ViktorC/PararealML',
author='Viktor Csomor',
author_email='[email protected]',
license='MIT',
packages=find_packages(),
include_package_data=True,
zip_safe=False)
install_requires=[
'numpy>=1.21',
'scipy>=1.7.0',
'matplotlib>=3.5.0',
'sympy>=1.6',
'mpi4py>=3.0.0',
'scikit-learn>=0.24.0',
'tensorflow>=2.0.0',
'tensorflow-probability>=0.10.0',
],
packages=find_packages(exclude=('tests',)),
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Scientific/Engineering :: Mathematics',
],
keywords=[
'differential equations',
'finite difference',
'parallel-in-time',
'parareal',
'machine learning',
'deep learning',
'physics-informed neural networks',
'scientific computing',
],
include_package_data=True)

0 comments on commit 0f9f5e1

Please sign in to comment.