From 40aaa4a4122834ff81ceffdd423c95355991ae28 Mon Sep 17 00:00:00 2001 From: Sebastian Schmitt <sebastian.schmitt@kip.uni-heidelberg.de> Date: Thu, 19 Aug 2021 16:34:55 +0200 Subject: [PATCH] Run examples via scripts (closes #1566) (#1631) * Run examples via scripts (closes #1566) --- .github/workflows/basic.yml | 33 +++------------------------------ .github/workflows/sanitize.yml | 11 +---------- scripts/run_cpp_examples.sh | 21 +++++++++++++++++++++ scripts/run_python_examples.sh | 21 +++++++++++++++++++++ 4 files changed, 46 insertions(+), 40 deletions(-) create mode 100755 scripts/run_cpp_examples.sh create mode 100755 scripts/run_python_examples.sh diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index e563ce38..f2400fab 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -161,28 +161,10 @@ jobs: run: mpirun -n 4 -oversubscribe build/bin/unit-mpi - if: ${{ matrix.config.mpi == 'OFF' }} name: Run examples - run: | - build/bin/bench - build/bin/brunel - build/bin/dryrun - build/bin/gap_junctions - build/bin/generators - build/bin/lfp - build/bin/probe-demo v - build/bin/ring - build/bin/single-cell + run: scripts/run_cpp_examples.sh - if: ${{ matrix.config.mpi == 'ON' }} name: Run examples with MPI - run: | - mpirun -n 4 -oversubscribe build/bin/bench - mpirun -n 4 -oversubscribe build/bin/brunel - mpirun -n 4 -oversubscribe build/bin/dryrun - mpirun -n 4 -oversubscribe build/bin/gap_junctions - mpirun -n 4 -oversubscribe build/bin/generators - mpirun -n 4 -oversubscribe build/bin/lfp - mpirun -n 4 -oversubscribe build/bin/probe-demo v - mpirun -n 4 -oversubscribe build/bin/ring - mpirun -n 4 -oversubscribe build/bin/single-cell + run: scripts/run_cpp_examples.sh "mpirun -n 4 -oversubscribe" - name: Run python tests run: | cd build @@ -192,13 +174,4 @@ jobs: name: Run python+MPI tests run: mpirun -n 4 -oversubscribe python python/test/unit_distributed/runner.py -v2 - name: Run Python examples - run: | - python python/example/network_ring.py - python python/example/single_cell_model.py - python python/example/single_cell_recipe.py - python python/example/single_cell_stdp.py - python python/example/brunel.py -n 400 -m 100 -e 20 -p 0.1 -w 1.2 -d 1 -g 0.5 -l 5 -t 100 -s 1 -G 50 -S 123 - python python/example/single_cell_swc.py python/example/single_cell_detailed.swc - python python/example/single_cell_detailed.py python/example/single_cell_detailed.swc - python python/example/single_cell_detailed_recipe.py python/example/single_cell_detailed.swc - python python/example/single_cell_cable.py + run: scripts/run_python_examples.sh diff --git a/.github/workflows/sanitize.yml b/.github/workflows/sanitize.yml index 1b40b7f0..1e7e371a 100644 --- a/.github/workflows/sanitize.yml +++ b/.github/workflows/sanitize.yml @@ -40,13 +40,4 @@ jobs: build/bin/unit --gtest_filter=-*DeathTest build/bin/unit-modcc - name: Run examples - run: | - build/bin/bench - build/bin/brunel - build/bin/dryrun - build/bin/gap_junctions - build/bin/generators - build/bin/lfp - build/bin/probe-demo v - build/bin/ring - build/bin/single-cell + run: scripts/run_cpp_examples.sh diff --git a/scripts/run_cpp_examples.sh b/scripts/run_cpp_examples.sh new file mode 100755 index 00000000..d463b29f --- /dev/null +++ b/scripts/run_cpp_examples.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# Runs all C++ examples + +set -Eeuo pipefail + +if [[ "$#" -gt 1 ]]; then + echo "usage: run_cpp_examples.sh <prefix, e.g., mpirun -n 4 -oversubscribe>" + exit 1 +fi + +PREFIX=${1:-} + +$PREFIX build/bin/bench +$PREFIX build/bin/brunel +$PREFIX build/bin/dryrun +$PREFIX build/bin/gap_junctions +$PREFIX build/bin/generators +$PREFIX build/bin/lfp +$PREFIX build/bin/probe-demo v +$PREFIX build/bin/ring +$PREFIX build/bin/single-cell diff --git a/scripts/run_python_examples.sh b/scripts/run_python_examples.sh new file mode 100755 index 00000000..5eca21dc --- /dev/null +++ b/scripts/run_python_examples.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# Runs all Python examples + +set -Eeuo pipefail + +if [[ "$#" -gt 1 ]]; then + echo "usage: run_python_examples.sh <prefix>" + exit 1 +fi + +PREFIX=${1:-} + +$PREFIX python python/example/network_ring.py +$PREFIX python python/example/single_cell_model.py +$PREFIX python python/example/single_cell_recipe.py +$PREFIX python python/example/single_cell_stdp.py +$PREFIX python python/example/brunel.py -n 400 -m 100 -e 20 -p 0.1 -w 1.2 -d 1 -g 0.5 -l 5 -t 100 -s 1 -G 50 -S 123 +$PREFIX python python/example/single_cell_swc.py python/example/single_cell_detailed.swc +$PREFIX python python/example/single_cell_detailed.py python/example/single_cell_detailed.swc +$PREFIX python python/example/single_cell_detailed_recipe.py python/example/single_cell_detailed.swc +$PREFIX python python/example/single_cell_cable.py -- GitLab