From ebf2f10c246fbd9c39608533869aa1111dc5262b Mon Sep 17 00:00:00 2001 From: Allan Karlson Date: Thu, 8 Aug 2019 13:09:34 +0200 Subject: [PATCH] provide a test script for travis to test mpi --- .travis.yml | 20 ++++++++++++++------ spotpy/examples/dds/dds_parallel.py | 2 +- spotpy/examples/dds/dds_parallel_data.json | 1 + 3 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 spotpy/examples/dds/dds_parallel_data.json diff --git a/.travis.yml b/.travis.yml index 6a3a0058..c8415012 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,18 @@ language: python python: - - "2.7" - - "3.5" + #- "2.7" + #- "3.5" - "3.6" + - "3.7" - # command to install dependencies +# this ubuntu distribution has sure the libopenmpi-dev packages available +dist: bionic + +# command to install dependencies install: + - sudo apt-get update + - sudo apt install libopenmpi-dev openmpi-bin + - pip install mpi4py - python setup.py install - pip install coveralls - pip install pathos @@ -14,17 +21,18 @@ install: - pip install pandas - pip install scipy - pip install click - # Need to force pytest-cov to v2.6 as current version (2.6.1) is deprecated - - pip install pytest pytest-pep8 pytest-cov==2.6 + # Need to force pytest-cov to v2.6 as current version (2.6.1) is deprecated and pytest:3.10.1 + - pip install pytest==3.10.1 pytest-pep8 pytest-cov==2.6 # Use docutils to generate html describe - pip install docutils - pip install numba - pip install tables + script: - pip uninstall spotpy -y - py.test spotpy/unittests/test_* --cov spotpy --cov-report term-missing -v - + - mpirun -c 2 python spotpy/examples/dds/dds_parallel.py 10 after_success: - coveralls diff --git a/spotpy/examples/dds/dds_parallel.py b/spotpy/examples/dds/dds_parallel.py index 264bfa90..15af96d0 100644 --- a/spotpy/examples/dds/dds_parallel.py +++ b/spotpy/examples/dds/dds_parallel.py @@ -38,7 +38,7 @@ print(dds_elapsed) benchmarks_duration["dds_duration"].append(dds_elapsed) -benchmarks_duration["dds_like"].append(dds_sampler.status.objectivefunction) +benchmarks_duration["dds_like"].append(dds_sampler.status.objectivefunction_max) benchmarks_duration["rep"].append(rep) print(benchmarks_duration) diff --git a/spotpy/examples/dds/dds_parallel_data.json b/spotpy/examples/dds/dds_parallel_data.json new file mode 100644 index 00000000..f3e7bcd8 --- /dev/null +++ b/spotpy/examples/dds/dds_parallel_data.json @@ -0,0 +1 @@ +{"dds_duration": [], "rep": [], "dds_like": []} \ No newline at end of file