Skip to content

Commit

Permalink
0.11.x ew ele (#103) (#104)
Browse files Browse the repository at this point in the history
* 0.11.x ew ele (#103)

* Make ew_ele datastructures type agnostic

* New CI (drone-1.0)

* fix bad indentation

* minor fixes

* syntaxfix

* pip.conf

* bash needed for echo -e ?

* req. pycvodes >=0.11.11

* fix ew_ele in native pycvodes req. pycvodes>=0.11.12

* more generous timeout

* up timeout

* fix pytest cmdline

* tweak CI (conda)

* Simplify conda-recipe version string
  • Loading branch information
bjodah authored Apr 10, 2019
1 parent 23d8adf commit c954498
Show file tree
Hide file tree
Showing 15 changed files with 227 additions and 104 deletions.
88 changes: 60 additions & 28 deletions .ci/get_sundials.sh
Original file line number Diff line number Diff line change
@@ -1,42 +1,64 @@
#!/bin/bash -eu
#!/bin/bash -u
#
# Usage:
#
# $ ./get_sundials.sh 3.1.1 /opt/sun-3.1.1 -DLAPACK_ENABLE:BOOL=ON -DSUNDIALS_INDEX_TYPE:STRING="int32_t"
# $ ./get_sundials.sh 2.7.0 /opt/sun-2.7.0 -DLAPACK_ENABLE:BOOL=OFF
#

VERSION=$1
PREFIX=$2
if [ -d "$PREFIX" ]; then 2>&1 echo "Directory already exists: $PREFIX"; exit 1; fi
if [[ $VERSION == "3.1.1" ]]; then
SUNDIALS_FNAME="sundials-3.1.1.tar.gz"
SUNDIALS_MD5="e63f4de0be5be97f750b30b0fa11ef34"
elif [[ $VERSION == "3.1.2" ]]; then
function quiet_unless_fail {
# suppresses function output unless exit status is != 0
OUTPUT_FILE=$(tempfile)
#/bin/rm --force /tmp/suppress.out 2>/dev/null
EXECMD=${1+"$@"}
$EXECMD > ${OUTPUT_FILE} 2>&1
EXIT_CODE=$?
if [ ${EXIT_CODE} -ne 0 ]; then
cat ${OUTPUT_FILE}
echo "The following command exited with exit status ${EXIT_CODE}: ${EXECMD}"
/bin/rm ${OUTPUT_FILE}
exit $?
fi
/bin/rm ${OUTPUT_FILE}
}

VERSION="$1"
PREFIX="$2"
if [ -d "$PREFIX" ]; then >&2 echo "Directory already exists: $PREFIX"; exit 1; fi
if [[ "$VERSION" == "2.7.0" ]]; then
SUNDIALS_FNAME="sundials-2.7.0.tar.gz"
SUNDIALS_MD5="c304631b9bc82877d7b0e9f4d4fd94d3"
SUNDIALS_SHA256="d39fcac7175d701398e4eb209f7e92a5b30a78358d4a0c0fcc23db23c11ba104"
elif [[ "$VERSION" == "3.1.2" ]]; then
SUNDIALS_FNAME="sundials-3.1.2.tar.gz"
SUNDIALS_MD5="63304dafc935c94a0ad37832085384bc"
elif [[ $VERSION == "3.2.0" ]]; then
SUNDIALS_FNAME="sundials-3.2.0.tar.gz"
SUNDIALS_MD5="669e05565d3294478848ed497ac35a6e"
elif [[ $VERSION == "3.2.1" ]]; then
SUNDIALS_SHA256="a8985bb1e851d90e24260450667b134bc13d71f5c6effc9e1d7183bd874fe116"
elif [[ "$VERSION" == "3.2.1" ]]; then
SUNDIALS_FNAME="sundials-3.2.1.tar.gz"
SUNDIALS_MD5="65c42e4fec7d1f4f4bcd670f9bbe31c0"
elif [[ $VERSION == "2.7.0" ]]; then
SUNDIALS_FNAME="sundials-2.7.0.tar.gz"
SUNDIALS_MD5="c304631b9bc82877d7b0e9f4d4fd94d3"
SUNDIALS_SHA256="47d94d977ab2382cdcdd02f72a25ebd4ba8ca2634bbb2f191fe1636e71c86808"
elif [[ "$VERSION" == "4.0.2" ]]; then
SUNDIALS_FNAME="sundials-4.0.2.tar.gz"
SUNDIALS_MD5="2d840ed467ca491a3c1fe4ce67d2a99a"
SUNDIALS_SHA256="6656d6938aed9142e61a001b1ed9f4ee4f7eaf003613bf5a887e98a85904d375"
elif [[ "$VERSION" == "4.1.0" ]]; then
SUNDIALS_FNAME="sundials-4.1.0.tar.gz"
SUNDIALS_MD5="f25bb0bc109ac3db0aaae13eadce559c"
SUNDIALS_SHA256="280de1c27b2360170a6f46cb3799b2aee9dff3bddbafc8b08c291a47ab258aa5"
else
2>&1 echo "Unknown sundials version $VERSION"
>&2 echo "Unknown sundials version \"$VERSION\""
fi

SUNDIALS_URLS=(\
"http://hera.physchem.kth.se/~repo/${SUNDIALS_MD5}/${SUNDIALS_FNAME}" \
"http://davycrockett.mooo.com:49090/~repo/${SUNDIALS_SHA256}/${SUNDIALS_FNAME}" \
"http://computation.llnl.gov/projects/sundials/download/${SUNDIALS_FNAME}" \
)
TIMEOUT=60 # 60 seconds

for URL in "${SUNDIALS_URLS[@]}"; do
if echo $SUNDIALS_MD5 $SUNDIALS_FNAME | md5sum -c --; then
echo "Found ${SUNDIALS_FNAME} with matching checksum, using this file."
echo "Found ${SUNDIALS_FNAME} with matching checksum, using that file."
else
echo "Downloading ${URL}..."
timeout $TIMEOUT wget --quiet --tries=2 --timeout=$TIMEOUT $URL -O $SUNDIALS_FNAME || continue
Expand All @@ -45,18 +67,28 @@ for URL in "${SUNDIALS_URLS[@]}"; do
tar xzf $SUNDIALS_FNAME
mkdir sundials_build
cd sundials_build
cmake -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX \
-DCMAKE_BUILD_TYPE:STRING="Release" \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DBUILD_STATIC_LIBS:BOOL=OFF \
-DEXAMPLES_ENABLE_C:BOOL=OFF \
-DEXAMPLES_INSTALL:BOOL=OFF \
-DOPENMP_ENABLE:BOOL=OFF \
"${@:3}" ../sundials-${VERSION}/
make -j 2 >/dev/null 2>&1
make install
( set -x; \
cmake -DCMAKE_INSTALL_PREFIX:PATH="$PREFIX" \
-DCMAKE_BUILD_TYPE:STRING="Release" \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DBUILD_STATIC_LIBS:BOOL=OFF \
-DEXAMPLES_ENABLE_C:BOOL=OFF \
-DEXAMPLES_INSTALL:BOOL=OFF \
-DOPENMP_ENABLE:BOOL=OFF \
"${@:3}" "../sundials-$VERSION/"
)
if [[ $? -ne 0 ]]; then
>&2 echo "Cmake configuration failed."
exit 1
fi
quiet_unless_fail make VERBOSE=1 -j 1
if [ $? -ne 0 ]; then
>&2 echo "Building of sundials \"$VERSION\" failed."
exit 1
fi
quiet_unless_fail make install
if [ $? -ne 0 ]; then
2>&1 echo "Build/install of sundials-${VERSION} failed."
>&2 echo "Install of sundials \"$VERSION\" failed."
exit 1
fi
cd ..
Expand Down
5 changes: 3 additions & 2 deletions .ci/run_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ export PYTHONHASHSEED=$(python3 -c "import random; print(random.randint(1,2**32-
PYTHON="python3 -R" ./scripts/run_tests.sh --cov $PKG_NAME --cov-report html

./scripts/render_notebooks.sh
(cd $PKG_NAME/tests; jupyter nbconvert --debug --to=html --ExecutePreprocessor.enabled=True --ExecutePreprocessor.timeout=360 *.ipynb)
(cd $PKG_NAME/tests; jupyter nbconvert --debug --to=html --ExecutePreprocessor.enabled=True --ExecutePreprocessor.timeout=600 *.ipynb)
./scripts/generate_docs.sh

# Test package without any 3rd party libraries that are in extras_require:
python3 -m pip install virtualenv
python3 -m virtualenv venv
git archive -o dist/$PKG_NAME-head.zip HEAD # test pip installable zip (symlinks break)
set +u
(source ./venv/bin/activate; python3 -m pip install pytest .; python3 -m pytest $PKG_NAME)
(source ./venv/bin/activate; cd dist/; python3 -m pip install pytest $PKG_NAME-head.zip; python3 -m pytest --pyargs $PKG_NAME)
1 change: 0 additions & 1 deletion .ci/test_py2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ python2 -m pip install --user virtualenv
python2 -m virtualenv /tmp/test_py2
sed -i -E -e "/python_requires/d" setup.py
bash -c "source /tmp/test_py2/bin/activate; pip install pytest '.[all]' && pytest -rs --pyargs ${PKG_NAME}"

146 changes: 97 additions & 49 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,103 @@
clone:
depth: 2
recursive: true
submodule_override:
external/anyode: git://github.com/bjodah/anyode.git
cache:
mount:
- /drone/sund-3.2.1-klu
- /drone/sund-3.2.1-nolapack-noklu-extended
build:
image: bjodah/bjodahimg18dev:v1.4
environment:
- OMP_NUM_THREADS=1
- ANYODE_NUM_THREADS=2
- CPLUS_INCLUDE_PATH=/usr/include/suitesparse
- LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
- LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
commands:
- git fetch -tq
- if [ ! -d /drone/sund-3.2.1-klu ]; then .ci/get_sundials.sh 3.2.1 /drone/sund-3.2.1-klu -DLAPACK_ENABLE:BOOL=ON -DSUNDIALS_INDEX_SIZE=32 -DKLU_ENABLE:BOOL=ON -DKLU_INCLUDE_DIR=/usr/include/suitesparse -DKLU_LIBRARY_DIR=/usr/lib/x86_64-linux-gnu; fi
- if [ ! -d /drone/sund-3.2.1-nolapack-noklu-extended ]; then .ci/get_sundials.sh 3.2.1 /drone/sund-3.2.1-nolapack-noklu-extended -DLAPACK_ENABLE:BOOL=OFF -DSUNDIALS_INDEX_SIZE=32 -DSUNDIALS_PRECISION:STRING="extended" -DKLU_ENABLE:BOOL=OFF; fi
# Need to install pycvodes from source for extended precision/int64 test, since
# that requires no LAPACK, whereas the pypi version installs with LAPACK
- git clone --recurse-submodules https://github.com/bjodah/pycvodes.git /drone/pycvodes
- cd /drone/pycvodes
- LIBRARY_PATH=/drone/sund-3.2.1-nolapack-noklu-extended/lib:$LIBRARY_PATH CPLUS_INCLUDE_PATH=/drone/sund-3.2.1-nolapack-noklu-extended/include:$CPLUS_INCLUDE_PATH LD_LIBRARY_PATH=/drone/sund-3.2.1-nolapack-noklu-extended/lib:$LD_LIBRARY_PATH PYCVODES_LAPACK=0 PYCVODES_NO_KLU=1 python3 setup.py install
- cd -
- .ci/run_ci.sh pyodesys /drone/sund-3.2.1-nolapack-noklu-extended
- rm -r /usr/local/lib/python*/dist-packages/pycvodes*
# Need to remove cache so that new sundials/pyodesys doesn't try to use the old
# compiled native code wrappers
- rm -r /root/.cache/*pyodesys*
# "Normal" (double, int) tests
- .ci/run_ci.sh pyodesys /drone/sund-3.2.1-klu
- ./scripts/prepare_deploy.sh
- .ci/test_py2.sh pyodesys /drone/sund-3.2.1-klu
- rm -r ~/.cache/python*pyodesys*/
- git clean -fd
- # PATH=/opt/miniconda3/bin:$PATH conda config --add channels bjodah # sym, pyodesys, pyneqsys
- # PATH=/opt/miniconda3/bin:$PATH conda upgrade --quiet conda-build
- # PATH=/opt/miniconda3/bin:$PATH conda build --output-folder "deploy/public_html/branches/${CI_BRANCH}" conda-recipe
- bash -c '[[ $(python3 setup.py --version) =~ ^[0-9]+.* ]]'
- ./scripts/grep-for-merge-blocking-token.sh
- ./scripts/grep-for-binary-data.sh
default:
image: plugins/git
recursive: true
submodule_override:
external/anyode: git://github.com/bjodah/anyode.git

pipeline:
restore-cache:
image: drillster/drone-volume-cache
restore: true
mount:
- ./ci_cache/sund-3.2.1-klu
- ./ci_cache/sund-4.1.0-nolapack-noklu-extended
- ./ci_cache/conda_packages
- ./ci_cache/pip_cache
volumes:
- /tmp/cache:/cache
ttl: 90 # liftetime in days

test-sund-3.2.1-klu:
group: testing
image: bjodah/bjodahimg18:v1.5
environment:
- OMP_NUM_THREADS=1
- ANYODE_NUM_THREADS=2
- CPLUS_INCLUDE_PATH=/usr/include/suitesparse
- LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
- LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
commands:
- export SUNDBASE=$(pwd)/ci_cache/sund-3.2.1-klu
- if [ ! -d $SUNDBASE ]; then .ci/get_sundials.sh 3.2.1 $SUNDBASE -DLAPACK_ENABLE:BOOL=ON -DSUNDIALS_INDEX_SIZE=32 -DKLU_ENABLE:BOOL=ON -DKLU_INCLUDE_DIR=/usr/include/suitesparse -DKLU_LIBRARY_DIR=/usr/lib/x86_64-linux-gnu; fi
- mkdir -p $HOME/.config/pip/; bash -c 'echo -e "[global]\nno-cache-dir = false\ndownload-cache = $(pwd)/ci_cache/pip_cache" >$HOME/.config/pip/pip.conf'
- bash -c "ulimit -v 2048000; .ci/run_ci.sh pyodesys $SUNDBASE"
- ./scripts/prepare_deploy.sh
- bash -c '[[ $(python3 setup.py --version) =~ ^[0-9]+.* ]]'
- ./scripts/grep-for-merge-blocking-token.sh
- ./scripts/grep-for-binary-data.sh

test-sund-4.1.0-nolapack-noklu-extended:
group: testing
image: bjodah/bjodahimg18:v1.5
environment:
- OMP_NUM_THREADS=1
- ANYODE_NUM_THREADS=2
- CPLUS_INCLUDE_PATH=/usr/include/suitesparse
- LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
- LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
commands:
- export SUNDBASE=$(pwd)/ci_cache/sund-4.1.0-nolapack-noklu-extended
- if [ ! -d $SUNDBASE ]; then .ci/get_sundials.sh 4.1.0 $SUNDBASE -DLAPACK_ENABLE:BOOL=OFF -DSUNDIALS_INDEX_SIZE=32 -DSUNDIALS_PRECISION:STRING="extended" -DKLU_ENABLE:BOOL=OFF; fi
# Need to install pycvodes from source for extended precision/int64 test, since
# that requires no LAPACK, whereas the pypi version installs with LAPACK
- git clone --recurse-submodules https://github.com/bjodah/pycvodes.git /tmp/pycvodes
- cd /tmp/pycvodes
- LIBRARY_PATH=$SUNDBASE/lib:$LIBRARY_PATH CPATH=$SUNDBASE/include:$CPATH LD_LIBRARY_PATH=$SUNDBASE/lib:$LD_LIBRARY_PATH PYCVODES_LAPACK=0 PYCVODES_NO_KLU=1 python3 setup.py install
- cd -
- mkdir -p $HOME/.config/pip/; bash -c 'echo -e "[global]\nno-cache-dir = false\ndownload-cache = $(pwd)/ci_cache/pip_cache" >$HOME/.config/pip/pip.conf'
- bash -c "ulimit -v 2048000; .ci/run_ci.sh pyodesys $SUNDBASE"

test-py2:
image: bjodah/bjodahimg18:v1.5
environment:
- OMP_NUM_THREADS=1
- ANYODE_NUM_THREADS=2
- CPLUS_INCLUDE_PATH=/usr/include/suitesparse
- LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
- LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
commands:
- export SUNDBASE=$(pwd)/ci_cache/sund-3.2.1-klu
- bash -c "ulimit -v 2048000; .ci/test_py2.sh pyodesys $SUNDBASE"

test-conda-recipe:
group: testing
image: bjodah/bjodahimg18dev:v1.5
commands:
- export CONDA_PKGS_DIRS=$(pwd)/ci_cache/conda_packages
- PATH=/opt/miniconda3/bin:$PATH conda update conda-build
- PATH=/opt/miniconda3/bin:$PATH conda build --output-folder "deploy/public_html/branches/${CI_BRANCH}" conda-recipe

deploy:

rsync:
host: hera.physchem.kth.se
rebuild-cache:
image: drillster/drone-volume-cache
rebuild: true
mount:
- ./ci_cache/sund-3.2.1-klu
- ./ci_cache/sund-4.1.0-nolapack-noklu-extended
- ./ci_cache/conda_packages
- ./ci_cache/pip_cache
volumes:
- /tmp/cache:/cache

deploy:
image: drillster/drone-rsync
when:
event: [push]
hosts: [ "hera.physchem.kth.se" ]
port: 22
user: pyodesys
source: deploy/
target: ~
recursive: true
delete: false
secrets: [ rsync_key ] # secret only set from event "push" not "pull_request"
source: ./deploy/public_html
target: ~/
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ gks.svg
.ipython/
.jupyter/*
!.jupyter/jupyter_notebook_config.py
tmp/
.gdb*
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
pyodesys
========

.. image:: http://hera.physchem.kth.se:9090/api/badges/bjodah/pyodesys/status.svg
:target: http://hera.physchem.kth.se:9090/bjodah/pyodesys
.. image:: http://hera.physchem.kth.se:8090/api/badges/bjodah/pyodesys/status.svg
:target: http://hera.physchem.kth.se:8090/bjodah/pyodesys
:alt: Build status on Drone
.. image:: https://circleci.com/gh/bjodah/pyodesys.svg?style=svg
:target: https://circleci.com/gh/bjodah/pyodesys
:alt: Build status on CircleCI
.. image:: https://img.shields.io/pypi/v/pyodesys.svg
:target: https://pypi.python.org/pypi/pyodesys
:alt: PyPI version
.. image:: https://img.shields.io/badge/python-2.7,3.5,3.6-blue.svg
.. image:: https://img.shields.io/badge/python-3.6,3.7-blue.svg
:target: https://www.python.org/
:alt: Python version
.. image:: https://img.shields.io/pypi/l/pyodesys.svg
Expand Down
8 changes: 2 additions & 6 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{% set name = "pyodesys" %}
{% set version = GIT_DESCRIBE_TAG | replace("v", "") %}
{% set number = GIT_DESCRIBE_NUMBER | int %}
{% if number > 0 %}
{% set version = version + ".post" + GIT_DESCRIBE_NUMBER %}
{% endif %}
{% set version = "0.13.0.dev0+git" %}

package:
name: {{ name|lower }}
Expand Down Expand Up @@ -33,7 +29,7 @@ requirements:
- boost
- pyodeint >=0.10.1
- pygslodeiv2 >=0.9.1
- pycvodes >=0.11.9
- pycvodes >=0.11.12
- pycompilation
- pycodeexport >=0.1.2
- cython
Expand Down
Loading

0 comments on commit c954498

Please # to comment.