File: test_service.sh

package info (click to toggle)
mpi4py 4.1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,540 kB
  • sloc: python: 34,465; ansic: 16,475; makefile: 614; sh: 325; cpp: 193; f90: 178
file content (34 lines) | stat: -rwxr-xr-x 1,317 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# shellcheck disable=SC2086
set -ex

PYTHON=${PYTHON:-python${py:-}}
MPIEXEC=${MPIEXEC-mpiexec}
testdir=$(dirname "$0")

if command -v mpichversion; then
    $MPIEXEC -n 1 $PYTHON -m mpi4py.futures.server --xyz > /dev/null 2>&1 || true
    $MPIEXEC -n 2 $PYTHON -m mpi4py.futures.server --bind localhost &
    mpi4pyserver=$!; sleep 0.25;
    $MPIEXEC -n 1 $PYTHON "$testdir"/test_service.py --host localhost
    wait $mpi4pyserver
    $MPIEXEC -n 2 $PYTHON -m mpi4py.futures.server --port 31414 --info "a=x,b=y" &
    mpi4pyserver=$!; sleep 0.25;
    $MPIEXEC -n 1 $PYTHON "$testdir"/test_service.py --port 31414 --info "a=x,b=y"
    wait $mpi4pyserver
fi

if command -v mpichversion && command -v hydra_nameserver; then
    hydra_nameserver &
    nameserver=$!; sleep 0.25;
    $MPIEXEC -nameserver localhost -n 2 $PYTHON -m mpi4py.futures.server &
    mpi4pyserver=$!; sleep 0.25;
    $MPIEXEC -nameserver localhost -n 1 $PYTHON "$testdir"/test_service.py
    wait $mpi4pyserver
    $MPIEXEC -nameserver localhost -n 2 $PYTHON -m mpi4py.futures.server --service test-service &
    mpi4pyserver=$!; sleep 0.25;
    $MPIEXEC -nameserver localhost -n 1 $PYTHON "$testdir"/test_service.py --service test-service
    wait $mpi4pyserver
    kill -TERM $nameserver
    wait $nameserver 2>/dev/null || true
fi