diff --git a/.ci/run_ci.sh b/.ci/run_ci.sh index 414773d3..e893f730 100755 --- a/.ci/run_ci.sh +++ b/.ci/run_ci.sh @@ -15,17 +15,21 @@ echo -e "[global]\nno-cache-dir = false\ndownload-cache = $(pwd)/ci_cache/pip_ca python3 -m pip install symcxx pysym # unofficial backends, symengine is tested in the conda build # (cd ./tmp/pycvodes; -CFLAGS="-isystem $SUNDBASE/include $CFLAGS" LDFLAGS="-Wl,--disable-new-dtags -Wl,-rpath,$SUNDBASE/lib -L$SUNDBASE/lib $LDFLAGS" python3 -m pip install pycvodes # setup.py install ) +SUND_CFLAGS="-isystem $SUNDBASE/include $CFLAGS" +SUND_LDFLAGS="-Wl,--disable-new-dtags -Wl,-rpath,$SUNDBASE/lib -L$SUNDBASE/lib $LDFLAGS" +CFLAGS=$SUND_CFLAGS LDFLAGS=$SUND_LDFLAGS python3 -m pip install pycvodes git clean -xfd # -e tmp/ -export CPATH=$SUNDBASE/include -export LIBRARY_PATH=$SUNDBASE/lib -export LD_LIBRARY_PATH=$SUNDBASE/lib +# export CPATH=$SUNDBASE/include +# export LIBRARY_PATH=$SUNDBASE/lib +# export LD_LIBRARY_PATH=$SUNDBASE/lib python3 setup.py sdist PKG_VERSION=$(python3 setup.py --version) (cd dist/; python3 -m pip install $PKG_NAME-$PKG_VERSION.tar.gz) python3 -m pip install -e .[all] +export PYODESYS_CVODE_FLAGS=$SUND_CFLAGS +export PYODESYS_CVODE_LDFLAGS=$SUND_LDFLAGS python3 -m pytest -xv -k test_integrate_chained_robertson pyodesys/tests/test_robertson.py export PYTHONHASHSEED=$(python3 -c "import random; print(random.randint(1,2**32-1))") PYTHON="python3 -R" ./scripts/run_tests.sh --cov $PKG_NAME --cov-report html diff --git a/.drone.yml b/.drone.yml index 0315eb9d..3081944d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,55 +17,55 @@ pipeline: ttl: 90 # liftetime in days # get-pre-reqs: - # image: bjodah/bjodahimg20dev:v1.1.0 + # image: bjodah/bjodahimg20dev:v1.2.0 # commands: # - mkdir ./tmp # - git clone --recurse-submodules https://github.com/bjodah/pycvodes.git ./tmp/pycvodes # test-py2: - # image: bjodah/bjodahimg20dev:v1.1.0 + # image: bjodah/bjodahimg20dev:v1.2.0 # environment: # - CC=gcc-10 # - CXX=g++-10 # - OMP_NUM_THREADS=1 # - ANYODE_NUM_THREADS=2 - # - CPLUS_INCLUDE_PATH=/usr/include/suitesparse:/opt/boost_1_72_p/include + # - CPLUS_INCLUDE_PATH=/usr/include/suitesparse:/opt/boost_1_73_p/include # - LIBRARY_PATH=/usr/lib/x86_64-linux-gnu # - LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu - # - SUNDBASE=/opt/sundials-5.2.0-klu-lapack + # - SUNDBASE=/opt/sundials-5.3.0-klu-lapack # commands: # - apt-get update && apt-get --assume-yes install python2-dev # - bash -c "ulimit -v 2048000; .ci/test_py2.sh pyodesys $SUNDBASE" - test-sund-5.2.0-klu: + test-sund-5.3.0-klu: group: testing - image: bjodah/bjodahimg20dev:v1.1.0 + image: bjodah/bjodahimg20dev:v1.2.0 environment: - CC=gcc-10 - CXX=g++-10 - OMP_NUM_THREADS=1 - ANYODE_NUM_THREADS=2 - - CPLUS_INCLUDE_PATH=/usr/include/suitesparse:/opt/boost_1_72_p/include + - CPLUS_INCLUDE_PATH=/usr/include/suitesparse:/opt/boost_1_73_p/include - LIBRARY_PATH=/usr/lib/x86_64-linux-gnu - LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu - - SUNDBASE=/opt/sundials-5.2.0-klu-lapack + - SUNDBASE=/opt/sundials-5.3.0-klu-lapack commands: - bash -c "ulimit -v 2048000; .ci/run_ci.sh pyodesys $SUNDBASE" - ./scripts/prepare_deploy.sh - bash -c '[[ $(python3 setup.py --version) =~ ^[0-9]+.* ]]' - test-sund-5.2.0-nolapack-noklu-extended: + test-sund-5.3.0-nolapack-noklu-extended: group: testing - image: bjodah/bjodahimg20dev:v1.1.0 + image: bjodah/bjodahimg20dev:v1.2.0 environment: - CC=gcc-10 - CXX=g++-10 - OMP_NUM_THREADS=1 - ANYODE_NUM_THREADS=2 - - CPLUS_INCLUDE_PATH=/usr/include/suitesparse:/opt/boost_1_72_p/include + - CPLUS_INCLUDE_PATH=/usr/include/suitesparse:/opt/boost_1_73_p/include - LIBRARY_PATH=/usr/lib/x86_64-linux-gnu - LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu - - SUNDBASE=/opt/sundials-5.2.0-noklu-nolapack-extended-int64 + - SUNDBASE=/opt/sundials-5.3.0-noklu-nolapack-extended-int64 - PYCVODES_NO_LAPACK=1 - PYCVODES_NO_KLU=1 commands: diff --git a/README.rst b/README.rst index 21c4a695..28e78f86 100644 --- a/README.rst +++ b/README.rst @@ -92,7 +92,7 @@ the solvers and then their python bindings. The 3rd party requirements are as fo - pygslodeiv2_ (requires GSL_ >=1.16) - pyodeint_ (requires boost_ >=1.72.0) -- pycvodes_ (requires SUNDIALS_ >=5.2.0) +- pycvodes_ (requires SUNDIALS_ >=5.3.0) .. _GSL: https://www.gnu.org/software/gsl/ .. _boost: http://www.boost.org/ diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index a876c131..ba2038dd 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -29,7 +29,7 @@ requirements: - pyodeint >=0.10.1 - pygslodeiv2 >=0.9.1 - pycvodes >=0.11.12 - - pycompilation >=0.4.6 + - pycompilation >=0.4.9 - pycodeexport >=0.1.2 - cython - python-symengine diff --git a/external/anyode b/external/anyode index f3d3b42a..ce9db8c9 160000 --- a/external/anyode +++ b/external/anyode @@ -1 +1 @@ -Subproject commit f3d3b42afe6b75248994497901f8f2881f5c8987 +Subproject commit ce9db8c91adf036657219a3cdf3c251483a3f0f7 diff --git a/pyodesys/_release.py b/pyodesys/_release.py index 8ccbf255..937fb5d0 100644 --- a/pyodesys/_release.py +++ b/pyodesys/_release.py @@ -1 +1 @@ -__version__ = '0.13.0.dev0+git' +__version__ = '0.13.1.dev0+git' diff --git a/pyodesys/native/_base.py b/pyodesys/native/_base.py index f8c8d947..93281f86 100644 --- a/pyodesys/native/_base.py +++ b/pyodesys/native/_base.py @@ -80,6 +80,10 @@ class _NativeCodeBase(Cpp_Code): # `namespace_extend` is set in init def __init__(self, odesys, *args, **kwargs): + if Cpp_Code is object: + raise ModuleNotFoundError("failed to import Cpp_Code from pycodeexport") + if compile_sources is None: + raise ModuleNotFoundError("failed to import compile_sources from pycompilation") if odesys.nroots > 0 and not self._support_roots: raise ValueError("%s does not support nroots > 0" % self.__class__.__name__) self.namespace_override = kwargs.pop('namespace_override', {}) diff --git a/pyodesys/native/cvode.py b/pyodesys/native/cvode.py index b8be353f..8eae2110 100644 --- a/pyodesys/native/cvode.py +++ b/pyodesys/native/cvode.py @@ -8,7 +8,7 @@ from ..util import import_ from ._base import _NativeCodeBase, _NativeSysBase, _compile_kwargs -_config, get_include, _libs = import_('pycvodes', 'config', 'get_include', "_libs") +get_include, config, _libs = import_("pycvodes", "get_include", "config", "_libs") if sys.version_info < (3, 6, 0): class ModuleNotFoundError(ImportError): @@ -19,8 +19,8 @@ class NativeCvodeCode(_NativeCodeBase): wrapper_name = '_cvode_wrapper' try: - _realtype = _config['REAL_TYPE'] - _indextype = _config['INDEX_TYPE'] + _realtype = config['REAL_TYPE'] + _indextype = config['INDEX_TYPE'] except ModuleNotFoundError: _realtype = '#error "realtype_failed-to-import-pycvodes-or-too-old-version"' _indextype = '#error "indextype_failed-to-import-pycvodes-or-too-old-version"' @@ -37,13 +37,15 @@ class NativeCvodeCode(_NativeCodeBase): def __init__(self, *args, **kwargs): self.compile_kwargs = copy.deepcopy(_compile_kwargs) - self.compile_kwargs['define'] = ['PYCVODES_NO_KLU={}'.format("0" if _config.get('KLU', True) else "1"), - 'PYCVODES_NO_LAPACK={}'.format("0" if _config.get('LAPACK', True) else "1"), - 'ANYODE_NO_LAPACK={}'.format("0" if _config.get('LAPACK', True) else "1")] + self.compile_kwargs['define'] = ['PYCVODES_NO_KLU={}'.format("0" if config.get('KLU', True) else "1"), + 'PYCVODES_NO_LAPACK={}'.format("0" if config.get('LAPACK', True) else "1"), + 'ANYODE_NO_LAPACK={}'.format("0" if config.get('LAPACK', True) else "1")] self.compile_kwargs['include_dirs'].append(get_include()) self.compile_kwargs['libraries'].extend(_libs.get_libs().split(',')) self.compile_kwargs['libraries'].extend([l for l in os.environ.get( - 'PYODESYS_LAPACK', "lapack,blas" if _config["LAPACK"] else "").split(",") if l != ""]) + 'PYODESYS_LAPACK', "lapack,blas" if config["LAPACK"] else "").split(",") if l != ""]) + self.compile_kwargs['flags'] = [f for f in os.environ.get("PYODESYS_CVODE_FLAGS", "").split() if f] + self.compile_kwargs['ldflags'] = [f for f in os.environ.get("PYODESYS_CVODE_LDFLAGS", "").split() if f] super(NativeCvodeCode, self).__init__(*args, **kwargs) diff --git a/setup.py b/setup.py index 3cdbcb51..033007da 100755 --- a/setup.py +++ b/setup.py @@ -77,8 +77,8 @@ def _path_under_setup(*args): _author, _author_email = open(_path_under_setup('AUTHORS'), 'rt').readline().split('<') extras_req = { - 'integrators': ['pyodeint>=0.10.3', 'pycvodes>=0.13', 'pygslodeiv2>=0.9.3'], - 'native': ['pycompilation>=0.4.3', 'pycodeexport>=0.1.2', 'appdirs'], + 'integrators': ['pyodeint>=0.10.3', 'pycvodes>=0.13.1', 'pygslodeiv2>=0.9.3'], + 'native': ['pycompilation>=0.4.9', 'pycodeexport>=0.1.2', 'appdirs'], 'docs': ['Sphinx', 'sphinx_rtd_theme', 'numpydoc'], 'testing': ['pytest', 'pytest-cov', 'pytest-flakes', 'pytest-pep8', 'rstcheck'] }