diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fac9a6d..9a08af3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ # The pre-commit hooks (ruff, file checks, no em dashes) and the test suite on a source build, on Linux, -# macOS and Windows with the oldest and the newest supported Python. +# macOS and Windows with the oldest and the newest supported Python, each with msolve built from source. name: CI # master moves only by fast-forward to a commit its pull request has tested @@ -41,7 +41,40 @@ jobs: allow-prereleases: true - name: Install from source run: python -m pip install ".[test]" + # msolve per runner image, rebuilt when the build script or the version changes + - name: Cache msolve + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ runner.temp }}/symident-cache + key: msolve-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('src/symident/tools/build-msolve.sh', 'src/symident/install.py') }} + - name: Build msolve + if: runner.os != 'Windows' + env: + SYMIDENT_CACHE: ${{ runner.temp }}/symident-cache + run: python -c "from symident import install; install.find_msolve()[0] or install.install_msolve(ask=False, jobs=4)" + # install_msolve() does not build on Windows: the same script under MSYS2, passed on by SYMIDENT_MSOLVE + - uses: msys2/setup-msys2@3c51bf698df1e37b2261f53cb67797b97761185c # v2.34.0 + if: runner.os == 'Windows' + with: + msystem: UCRT64 + install: mingw-w64-ucrt-x86_64-gcc make m4 curl tar xz + - name: Build msolve on Windows + if: runner.os == 'Windows' + shell: msys2 {0} + run: | + export SYMIDENT_LIBS_CACHE="$(cygpath -u "$RUNNER_TEMP")/symident-cache" SYMIDENT_JOBS=4 CC=gcc + prefix="$SYMIDENT_LIBS_CACHE/deps-msolve-0.11.0" + [ -f "$prefix/.msolve-complete" ] || sh src/symident/tools/build-msolve.sh + echo "SYMIDENT_MSOLVE=$(cygpath -w "$prefix/bin/msolve.exe")" >> "$GITHUB_ENV" + cygpath -w /ucrt64/bin >> "$GITHUB_PATH" + # the msolve tests skip where msolve is missing; here it must be found + - name: Check msolve + env: + SYMIDENT_CACHE: ${{ runner.temp }}/symident-cache + run: python -c "from symident import install; p, s = install.find_msolve(); assert p, 'no msolve'; print(p, s)" # outside the checkout, so that the tests import the installed package - name: Tests working-directory: ${{ runner.temp }} + env: + SYMIDENT_CACHE: ${{ runner.temp }}/symident-cache run: python -m pytest -q -n auto "${{ github.workspace }}/tests" diff --git a/NEWS.md b/NEWS.md index 87b2fe3..0825e44 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,15 @@ +# symident 0.18.4 + +* The counts modulo a prime over the reduced Gröbner basis pass the coefficients to msolve reduced + modulo the prime, so they are the same on Windows as on Linux and macOS; the check of a resting + state names the error bound on every platform. +* `memory` of `discrete()` and of `global_options` limits the address space of msolve on Linux only; + macOS does not enforce the limit and Windows has none. +* `install_msolve()` retries each download three times and takes GMP and MPFR from a GNU mirror + when ftp.gnu.org does not answer. +* The tests of the continuous integration run with msolve built from source on Linux, macOS and + Windows, msolve kept in the cache of each runner image. + # symident 0.18.3 ## Global analysis diff --git a/docs/guide/global.rst b/docs/guide/global.rst index cfcb68d..fbf671a 100644 --- a/docs/guide/global.rst +++ b/docs/guide/global.rst @@ -14,7 +14,7 @@ Calling the global analysis second step on a result of a local detection. ``global_options`` passes the arguments of :meth:`~symident.Symmetries.discrete`: ``order``, the highest Taylor coefficient of the observables, ``points``, the number of random points of the count in the domain, ``memory``, the -address space of one call of msolve, ``experiments``, the count of several experiments, and the +address space of one call of msolve (on Linux), ``experiments``, the count of several experiments, and the work limits ``msolve_work`` (the work of the F4 rounds of one msolve call, 1e10), ``msolve_terms`` (terms of one system given to msolve, 1e5), ``search_entries`` (entries of the matrices over :math:`\mathbb{F}_p` the exact search reduces, 2e9) and ``elimination_terms`` (terms diff --git a/pyproject.toml b/pyproject.toml index dd1dac1..b92ab70 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build" [project] name = "symident" -version = "0.18.3" +version = "0.18.4" description = "Structural identifiability of ODE models by Lie symmetries over finite fields" readme = "README.md" requires-python = ">=3.10" diff --git a/src/symident/__init__.py b/src/symident/__init__.py index a7e6f30..b875e6d 100644 --- a/src/symident/__init__.py +++ b/src/symident/__init__.py @@ -19,4 +19,4 @@ "install_msolve", "switches", ] -__version__ = "0.18.3" +__version__ = "0.18.4" diff --git a/src/symident/api.py b/src/symident/api.py index b721854..b596282 100644 --- a/src/symident/api.py +++ b/src/symident/api.py @@ -541,7 +541,7 @@ def discrete( Threads of msolve. memory : float, optional GiB of address space one call of msolve may take, 8 by default; past it the call - fails. + fails. The limit applies on Linux; macOS does not enforce it and Windows has none. experiments : bool or int, optional The count of several experiments with shared parameters and free starts, projected onto the parameters and starts of the first, which bounds the fiber of a model with diff --git a/src/symident/detection/discrete.py b/src/symident/detection/discrete.py index b8f4757..e40479c 100644 --- a/src/symident/detection/discrete.py +++ b/src/symident/detection/discrete.py @@ -2100,6 +2100,10 @@ def find(i): return list(out.values()) +# an integer literal, not a digit of a name +_INT = re.compile(r"(?/dev/null 2>&1; then curl -fsSL -o "$2" "$1" - else wget -q -O "$2" "$1"; fi + out=$1; shift + for url in "$@"; do + if command -v curl >/dev/null 2>&1; then + curl -fsSL --retry 3 --connect-timeout 30 -o "$out" "$url" && return 0 + else + wget -q --tries=3 --timeout=30 -O "$out" "$url" && return 0 + fi + done + return 1 } +# GNU sources from the main server or a mirror +gnu() { fetch "$2" "https://ftp.gnu.org/gnu/$1" "https://ftpmirror.gnu.org/gnu/$1"; } step() { echo "==> $*" >&2; } step "GMP $GMP" -fetch "https://ftp.gnu.org/gnu/gmp/gmp-$GMP.tar.xz" gmp.tar.xz +gnu "gmp/gmp-$GMP.tar.xz" gmp.tar.xz tar xf gmp.tar.xz # generic build triples: the binary runs on every CPU of the architecture, not only on the # one that built it @@ -34,20 +44,20 @@ tar xf gmp.tar.xz --disable-shared --enable-static --with-pic >&2 && make -j"$JOBS" >&2 && make install >&2) step "MPFR $MPFR" -fetch "https://ftp.gnu.org/gnu/mpfr/mpfr-$MPFR.tar.xz" mpfr.tar.xz +gnu "mpfr/mpfr-$MPFR.tar.xz" mpfr.tar.xz tar xf mpfr.tar.xz (cd "mpfr-$MPFR" && ./configure --prefix="$PREFIX" --disable-shared --enable-static \ --with-pic --with-gmp="$PREFIX" >&2 && make -j"$JOBS" >&2 && make install >&2) step "FLINT $FLINT" -fetch "https://github.com/flintlib/flint/releases/download/v$FLINT/flint-$FLINT.tar.gz" flint.tar.gz +fetch flint.tar.gz "https://github.com/flintlib/flint/releases/download/v$FLINT/flint-$FLINT.tar.gz" tar xzf flint.tar.gz (cd "flint-$FLINT" && ./configure --build="$(sh config/configfsf.guess)" --prefix="$PREFIX" \ --disable-shared --enable-static --with-pic --with-gmp="$PREFIX" --with-mpfr="$PREFIX" >&2 && make -j"$JOBS" >&2 && make install >&2) step "msolve $MSOLVE" -fetch "https://github.com/algebraic-solving/msolve/archive/refs/tags/v$MSOLVE.tar.gz" msolve.tar.gz +fetch msolve.tar.gz "https://github.com/algebraic-solving/msolve/archive/refs/tags/v$MSOLVE.tar.gz" tar xzf msolve.tar.gz cd "msolve-$MSOLVE" cat > config.h <