From d6927803ebc1a8bb60fcee68b984a373dc87b196 Mon Sep 17 00:00:00 2001 From: Marcello Seri Date: Wed, 12 May 2021 17:15:13 +0200 Subject: [PATCH 01/12] Move to GitHub Actions Signed-off-by: Marcello Seri --- .github/workflows/ci.yml | 52 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 22 ----------------- 2 files changed, 52 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..dc6f1e5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: Main workflow + +on: + - pull_request + - push + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: + - macos-latest + - ubuntu-latest + # - windows-latest + ocaml-version: + - 4.12.x + - 4.11.x + - 4.10.x + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Use OCaml ${{ matrix.ocaml-version }} + uses: avsm/setup-ocaml@v1 + with: + ocaml-version: ${{ matrix.ocaml-version }} + + - run: | + opam pin add owl-ode-base.dev . --no-action + opam pin add owl-ode.dev . --no-action + opam pin add owl-ode-odepack.dev . --no-action + + - run: opam depext --yes --with-test owl-ode-base owl-ode owl-ode-odepack + + - run: | + opam install owl-ode-base --deps-only --with-test + opam exec -- dune build -p owl-ode-base + opam exec -- dune runtest -p owl-ode-base + + - run: | + opam install owl-ode --deps-only --with-test + opam exec -- dune build -p owl-ode + opam exec -- dune runtest -p owl-ode + + - run: | + opam install owl-ode-odepack --deps-only --with-test + opam exec -- dune build -p owl-ode-odepack + opam exec -- dune runtest -p owl-ode-odepack \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 23969d9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: c -sudo: false -services: - - docker -install: wget https://raw.githubusercontent.com/ocaml/ocaml-travisci-skeleton/master/.travis-docker.sh -script: bash -ex ./.travis-docker.sh -env: - global: - - PINS="owl-ode-base.dev:. owl-ode.dev:. owl-ode-odepack.dev:. owl-ode-sundials.dev:. owl.dev:https://github.com/owlbarn/owl/archive/master.tar.gz owl-base.dev:https://github.com/owlbarn/owl/archive/master.tar.gz owl-plplot.dev:https://github.com/owlbarn/owl/archive/master.tar.gz" - matrix: - - PACKAGE="owl-ode-base" DISTRO="debian-stable" OCAML_VERSION="4.10" - - PACKAGE="owl-ode" DISTRO="fedora" OCAML_VERSION="4.10" - - PACKAGE="owl-ode" DISTRO="debian-stable" OCAML_VERSION="4.10" - - PACKAGE="owl-ode" DISTRO="ubuntu" OCAML_VERSION="4.10" - - PACKAGE="owl-ode-odepack" DISTRO="debian-stable" OCAML_VERSION="4.10" - - PACKAGE="owl-ode-sundials" DISTRO="debian-stable" OCAML_VERSION="4.10" - -matrix: - fast_finish: true - allow_failures: - - env: PACKAGE="owl-ode-sundials" DISTRO="debian-stable" OCAML_VERSION="4.10" - - env: PACKAGE="owl-ode" DISTRO="ubuntu" OCAML_VERSION="4.10" From f587325a3925888c1a70890b4c44fb4568ac08b7 Mon Sep 17 00:00:00 2001 From: Marcello Seri Date: Wed, 12 May 2021 17:21:24 +0200 Subject: [PATCH 02/12] Update README Signed-off-by: Marcello Seri --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index b55b0bb..677e8b0 100644 --- a/README.md +++ b/README.md @@ -175,6 +175,29 @@ As such, they are compatible for use in Mirage OS or in conjunction with `js_of_ You can see an example of this here: http://www.mseri.me/owlde-demo-icfp2019/ (source code: https://github.com/mseri/owlde-demo-icfp2019) +## Citing + +If you have used this package for research that resulted in a publication, please be kind enough to cite the software paper associated with DynamicalBilliards. The DOI is https://doi.org/10.21105/joss.01812 and you can cite as: + +> Seri et al., (2019). OwlDE: making ODEs first-class Owl citizens. Journal of Open Source Software, 4(44), 1812, https://doi.org/10.21105/joss.01812 + +or if you use BibTeX: + +```bibtex +@article{Seri2019, + doi = {10.21105/joss.01812}, + url = {https://doi.org/10.21105/joss.01812}, + year = {2019}, + publisher = {The Open Journal}, + volume = {4}, + number = {44}, + pages = {1812}, + author = {Marcello Seri and Ta-Chu Kao}, + title = {OwlDE: making ODEs first-class `Owl` citizens}, + journal = {Journal of Open Source Software} +} +``` + ## NOTES The main idea is develop a uniform interface to integrate ODE solvers (and in the future finite element methods) into Owl. From 4e1733079987bb1b1163b4c5ac61980058bdcb1c Mon Sep 17 00:00:00 2001 From: Marcello Seri Date: Wed, 12 May 2021 17:26:34 +0200 Subject: [PATCH 03/12] Use master of gh ocaml Signed-off-by: Marcello Seri --- .github/workflows/ci.yml | 4 +++- README.md | 25 ++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc6f1e5..0e19353 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,9 +25,11 @@ jobs: uses: actions/checkout@v2 - name: Use OCaml ${{ matrix.ocaml-version }} - uses: avsm/setup-ocaml@v1 + uses: actions-ml/setup-ocaml@master with: ocaml-version: ${{ matrix.ocaml-version }} + opam-depext: false + opam-pin: false - run: | opam pin add owl-ode-base.dev . --no-action diff --git a/README.md b/README.md index 677e8b0..fb6118f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,26 @@ # OwlDE - Ordinary Differential Equation Solvers [![DOI](https://joss.theoj.org/papers/10.21105/joss.01812/status.svg)](https://doi.org/10.21105/joss.01812) [![Build Status](https://travis-ci.org/owlbarn/owl_ode.svg?branch=master)](https://travis-ci.org/owlbarn/owl_ode) +## Table of contents + +* [Tutorial](#tutorial) + + [Overview](#overview) + + [Sundials Cvode](#sundials-cvode) + + [ODEPACK Lsoda](#odepack-lsoda) + + [Automatic inference of state dimensionality](#automatic-inference-of-state-dimensionality) + + [Custom Solvers](#custom-solvers) +* [Supported Solvers](#supported-solvers) + + [Native](#native) + + [Symplectic](#symplectic) + + [Sundials](#sundials) + + [ODEPACK](#odepack) +* [JavaScript and Mirage backends](#javascript-and-mirage-backends) +* [Citing](#citing) +* [Notes](#notes) +* [Further comments](#further-comments) +* [Contributing](#contributing) + +## Tutorial + Please refer to the relevant [`owl` projects page](https://ocaml.xyz/project/finished.html#ordinary-differential-equation-solver) for more details. The library is published on the opam repository and can be installed with `opam`: @@ -30,8 +51,6 @@ See also the [SUNDIALS section of this README](https://github.com/owlbarn/owl_od The documentation for the library is accessible at [ocaml.xyz/owl\_ode/owl-ode](http://ocaml.xyz/owl_ode/owl-ode/). -## Tutorial - ### Overview Consider the problem of integrating a linear dymaical system that evolves according to @@ -198,7 +217,7 @@ or if you use BibTeX: } ``` -## NOTES +## Notes The main idea is develop a uniform interface to integrate ODE solvers (and in the future finite element methods) into Owl. Currently there are three options available, providing incompatible underlying representations: From 36998f3f9ef1395c862eb6380807c5c52674d6e3 Mon Sep 17 00:00:00 2001 From: Marcello Seri Date: Wed, 12 May 2021 17:49:02 +0200 Subject: [PATCH 04/12] Update workflow Signed-off-by: Marcello Seri --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e19353..df8ba42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,7 @@ jobs: opam exec -- dune runtest -p owl-ode - run: | - opam install owl-ode-odepack --deps-only --with-test + # there seems to be sandboxing issues with conf-gfortran + opam install owl-ode odepack opam exec -- dune build -p owl-ode-odepack opam exec -- dune runtest -p owl-ode-odepack \ No newline at end of file From bce2b15a221b3033a479ad86c76044988a5b6ea2 Mon Sep 17 00:00:00 2001 From: Marcello Seri Date: Wed, 12 May 2021 22:35:08 +0200 Subject: [PATCH 05/12] Update .github/workflows/ci.yml Co-authored-by: Kate --- .github/workflows/ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df8ba42..0c8778b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,13 @@ jobs: opam pin add owl-ode.dev . --no-action opam pin add owl-ode-odepack.dev . --no-action - - run: opam depext --yes --with-test owl-ode-base owl-ode owl-ode-odepack + - run: | + brew list + opam depext --yes --with-test owl-ode-base owl-ode owl-ode-odepack + brew list + ls /usr/local/bin + gfortran --version + which gfortran - run: | opam install owl-ode-base --deps-only --with-test @@ -52,4 +58,4 @@ jobs: # there seems to be sandboxing issues with conf-gfortran opam install owl-ode odepack opam exec -- dune build -p owl-ode-odepack - opam exec -- dune runtest -p owl-ode-odepack \ No newline at end of file + opam exec -- dune runtest -p owl-ode-odepack From 55efc05bf506c57a4ce915547460ca5f316c3772 Mon Sep 17 00:00:00 2001 From: Marcello Seri Date: Thu, 13 May 2021 11:07:41 +0200 Subject: [PATCH 06/12] Update ci.yml --- .github/workflows/ci.yml | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c8778b..4c30e34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,17 +24,14 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Use OCaml ${{ matrix.ocaml-version }} - uses: actions-ml/setup-ocaml@master + - name: Use OCaml ${{ matrix.ocaml-compiler }} + uses: avsm/setup-ocaml@v2 with: - ocaml-version: ${{ matrix.ocaml-version }} - opam-depext: false - opam-pin: false - - - run: | - opam pin add owl-ode-base.dev . --no-action - opam pin add owl-ode.dev . --no-action - opam pin add owl-ode-odepack.dev . --no-action + ocaml-compiler: ${{ matrix.ocaml-compiler }} + dune-cache: true + opam-local-packages: | + *.opam + !owl-ode-sundials.opam - run: | brew list @@ -43,19 +40,4 @@ jobs: ls /usr/local/bin gfortran --version which gfortran - - - run: | - opam install owl-ode-base --deps-only --with-test - opam exec -- dune build -p owl-ode-base - opam exec -- dune runtest -p owl-ode-base - - - run: | - opam install owl-ode --deps-only --with-test - opam exec -- dune build -p owl-ode - opam exec -- dune runtest -p owl-ode - - - run: | - # there seems to be sandboxing issues with conf-gfortran - opam install owl-ode odepack - opam exec -- dune build -p owl-ode-odepack - opam exec -- dune runtest -p owl-ode-odepack + From 99bec5d0b0e158c881ecb0a53afc93d6b07568cf Mon Sep 17 00:00:00 2001 From: Marcello Seri Date: Thu, 13 May 2021 13:28:14 +0200 Subject: [PATCH 07/12] Update ci.yml --- .github/workflows/ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c30e34..9a1d428 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,4 +40,18 @@ jobs: ls /usr/local/bin gfortran --version which gfortran + + - run: | + opam install owl-ode-base --yes --deps-only --with-test + opam exec -- dune build -p owl-ode-base + opam exec -- dune runtest -p owl-ode-base + + - run: | + opam install owl-ode --yes --deps-only --with-test + opam exec -- dune build -p owl-ode + opam exec -- dune runtest -p owl-ode + - run: | + opam install owl-ode-odepack --yes --deos-only --with-test + opam exec -- dune build -p owl-ode-odepack + opam exec -- dune runtest -p owl-ode-odepack From 2b94bc1c0bfbe04ab9b87c29c1d38ba6a279c85c Mon Sep 17 00:00:00 2001 From: Marcello Seri Date: Thu, 13 May 2021 13:42:56 +0200 Subject: [PATCH 08/12] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a1d428..1c5e2bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,6 @@ jobs: opam exec -- dune runtest -p owl-ode - run: | - opam install owl-ode-odepack --yes --deos-only --with-test + opam install owl-ode-odepack --yes --deps-only --with-test opam exec -- dune build -p owl-ode-odepack opam exec -- dune runtest -p owl-ode-odepack From 890bb7ddd7094ed5751aae29adb97850aa28d306 Mon Sep 17 00:00:00 2001 From: Marcello Seri Date: Fri, 14 May 2021 10:01:14 +0200 Subject: [PATCH 09/12] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c5e2bc..9f8acd0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: uses: avsm/setup-ocaml@v2 with: ocaml-compiler: ${{ matrix.ocaml-compiler }} - dune-cache: true + dune-cache: false opam-local-packages: | *.opam !owl-ode-sundials.opam From eff48c35ca1f00f3c9d9545d9945990f62ea8457 Mon Sep 17 00:00:00 2001 From: Marcello Seri Date: Fri, 14 May 2021 10:46:23 +0200 Subject: [PATCH 10/12] Cleanup and attempt fixing dune-cache Signed-off-by: Marcello Seri --- .github/sandbox_exec.sh | 92 ++++++++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 11 ++--- 2 files changed, 95 insertions(+), 8 deletions(-) create mode 100644 .github/sandbox_exec.sh diff --git a/.github/sandbox_exec.sh b/.github/sandbox_exec.sh new file mode 100644 index 0000000..370bb58 --- /dev/null +++ b/.github/sandbox_exec.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash +set -ue + +POL='(version 1)(allow default)(deny network*)(deny file-write*)' +POL="$POL"'(allow network* (remote unix))' +POL="$POL"'(allow file-write* (literal "/dev/null") (literal "/dev/dtracehelper"))' + +add_mounts() { + if [ -d "$2" ]; then + local DIR="$(cd "$2" && pwd -P)" + case "$1" in + ro) POL="$POL"'(deny file-write* (subpath "'"$DIR"'"))';; + rw) POL="$POL"'(allow file-write* (subpath "'"$DIR"'"))';; + esac + fi +} + +# Even if TMPDIR is set, some applications uses /tmp directly +add_mounts rw /tmp + +if [ -z ${TMPDIR+x} ]; then + # Others applications obtain the per-user temporary + # directory differently; the latter should be made readable/writable + # too and getconf seems to be a robust way to get it + if [ -z /usr/bin/getconf ]; then + TMPDIR=$(getconf DARWIN_USER_TEMP_DIR) + add_mounts rw "$TMPDIR" + export TMPDIR + fi +else + add_mounts rw "$TMPDIR" +fi + +# C compilers using `ccache` will write to a shared cache directory +# that remain writeable. ccache seems widespread in some Fedora systems. +add_ccache_mount() { + if command -v ccache > /dev/null; then + ccache_dir_regex='cache_dir = (.*)$' + local IFS=$'\n' + for f in $(ccache -p 2>/dev/null); do + if [[ $f =~ $ccache_dir_regex ]]; then + ccache_dir=${BASH_REMATCH[1]} + break + fi + done + CCACHE_DIR=${CCACHE_DIR-$HOME/.ccache} + ccache_dir=${ccache_dir-$CCACHE_DIR} + add_mounts rw "$ccache_dir" + fi +} + +add_dune_cache_mount() { + local dune_cache=${XDG_CACHE_HOME:-$HOME/.cache}/dune + mkdir -p "${dune_cache}" + add_mounts rw "$dune_cache" +} + +# mount unusual path in ro +if [ -n "${OPAM_USER_PATH_RO-}" ]; then + add_mounts ro $(echo "${OPAM_USER_PATH_RO}" | sed 's|:| |g') +fi + +# When using opam variable that must be defined at action time, add them also +# at init check in OpamAuxCommands.check_and_revert_sandboxing (like +# OPAM_SWITCH_PREFIX). +# This case-switch should remain identical between the different sandbox implems +COMMAND="$1"; shift +case "$COMMAND" in + build) + add_mounts ro "$OPAM_SWITCH_PREFIX" + add_mounts rw "$PWD" + add_ccache_mount + add_dune_cache_mount + ;; + install) + add_mounts rw "$OPAM_SWITCH_PREFIX" + add_mounts ro "$OPAM_SWITCH_PREFIX/.opam-switch" + add_mounts rw "$PWD" + ;; + remove) + add_mounts rw "$OPAM_SWITCH_PREFIX" + add_mounts ro "$OPAM_SWITCH_PREFIX/.opam-switch" + if [ "X${PWD#$OPAM_SWITCH_PREFIX/.opam-switch/}" != "X${PWD}" ]; then + add_mounts rw "$PWD" + fi + ;; + *) + echo "$0: unknown command $COMMAND, must be one of 'build', 'install' or 'remove'" >&2 + exit 2 +esac + +exec sandbox-exec -p "$POL" "$@" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f8acd0..20b074f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,18 +28,13 @@ jobs: uses: avsm/setup-ocaml@v2 with: ocaml-compiler: ${{ matrix.ocaml-compiler }} - dune-cache: false + dune-cache: true opam-local-packages: | *.opam !owl-ode-sundials.opam - - run: | - brew list - opam depext --yes --with-test owl-ode-base owl-ode owl-ode-odepack - brew list - ls /usr/local/bin - gfortran --version - which gfortran + - run: cp ".github/sandbox_exec.sh" "$HOME/.opam/opam-init/hooks/sandbox.sh" + if: ${{ matrix.os == 'macos-latest' }} - run: | opam install owl-ode-base --yes --deps-only --with-test From 36c87aac8f57331bdba8c02e039b0e1f7fcd6df1 Mon Sep 17 00:00:00 2001 From: Marcello Seri Date: Fri, 14 May 2021 11:03:39 +0200 Subject: [PATCH 11/12] Install test deps Signed-off-by: Marcello Seri --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20b074f..a3a6c32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,8 @@ jobs: - run: cp ".github/sandbox_exec.sh" "$HOME/.opam/opam-init/hooks/sandbox.sh" if: ${{ matrix.os == 'macos-latest' }} + + - run: opam depext owl-ode-base owl-ode owl-ode-odepack --with-test - run: | opam install owl-ode-base --yes --deps-only --with-test From 40df01def394d34e6776e6a8e41194b5e3287b7d Mon Sep 17 00:00:00 2001 From: Marcello Seri Date: Fri, 14 May 2021 11:07:49 +0200 Subject: [PATCH 12/12] Add badge to README Signed-off-by: Marcello Seri --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fb6118f..eb484c6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# OwlDE - Ordinary Differential Equation Solvers [![DOI](https://joss.theoj.org/papers/10.21105/joss.01812/status.svg)](https://doi.org/10.21105/joss.01812) [![Build Status](https://travis-ci.org/owlbarn/owl_ode.svg?branch=master)](https://travis-ci.org/owlbarn/owl_ode) +# OwlDE - Ordinary Differential Equation Solvers [![DOI](https://joss.theoj.org/papers/10.21105/joss.01812/status.svg)](https://doi.org/10.21105/joss.01812) [![Build status](https://github.com/owlbarn/owl_ode/actions/workflows/ci.yml/badge.svg)](https://github.com/owlbarn/owl_ode/actions) ## Table of contents