Debian Codegraph @

testsuite/sanitytests/multicomm.test

raw
1 #!/bin/sh
2
3 NP=8
4 music_conf="$( echo "${0##*/}" | sed 's/\.test//' ).music"
5
6 abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
7 path="`dirname $abspath`"
8
9 . ${path}/run_test
10
11 write_configuration ()
12 {
13
14 method=$1
15 echo "Communication method: ${method}"
16
17 # this is music configuration file
18 cat <<EOF > "${MUSIC_DATA_PATH}/${music_conf}"
19 stoptime=1.0
20 np=2
21 [S0]
22 binary=${TEST_BINDIR}/eventsource
23 args=--out out0 10 ${MUSIC_DATA_PATH}/spikes
24 [S1]
25 binary=${TEST_BINDIR}/eventsource
26 args=--out out1 10 ${MUSIC_DATA_PATH}/spikes
27 [R0]
28 binary=${TEST_BINDIR}/eventlogger
29 args=--in in0
30 [R1]
31 binary=${TEST_BINDIR}/eventlogger
32 args=--in in1
33 S0.out0 -> R0.in0 [10, ${method}]
34 S1.out1 -> R1.in1 [10, ${method}]
35 EOF
36
37 }
38
39
40 # this is input data
41 cat <<\EOF > "${MUSIC_DATA_PATH}/spikes0.dat"
42 # spikes
43 0.0 0
44 0.1 1
45 0.2 2
46 0.3 3
47 0.4 4
48 EOF
49
50 cat <<\EOF > "${MUSIC_DATA_PATH}/spikes1.dat"
51 # spikes
52 0.0 9
53 0.6 5
54 0.7 6
55 0.8 7
56 0.9 8
57 EOF
58
59 # this is the output we should expect to see
60 cat <<\EOF > "${MUSIC_DATA_PATH}/ok"
61 Rank 0: Event (0, 0) detected at 0
62 Rank 0: Event (1, 0.1) detected at 0
63 Rank 0: Event (2, 0.2) detected at 0
64 Rank 0: Event (3, 0.3) detected at 0
65 Rank 0: Event (4, 0.4) detected at 0
66 Rank 1: Event (9, 0) detected at 0
67 Rank 1: Event (5, 0.6) detected at 0
68 Rank 1: Event (6, 0.7) detected at 0
69 Rank 1: Event (7, 0.8) detected at 0
70 Rank 1: Event (8, 0.9) detected at 0
71 Rank 0: Event (0, 0) detected at 0
72 Rank 0: Event (1, 0.1) detected at 0
73 Rank 0: Event (2, 0.2) detected at 0
74 Rank 0: Event (3, 0.3) detected at 0
75 Rank 0: Event (4, 0.4) detected at 0
76 Rank 1: Event (9, 0) detected at 0
77 Rank 1: Event (5, 0.6) detected at 0
78 Rank 1: Event (6, 0.7) detected at 0
79 Rank 1: Event (7, 0.8) detected at 0
80 Rank 1: Event (8, 0.9) detected at 0
81 EOF
82 # sort the file using locale specified by current environment
83 sort "${MUSIC_DATA_PATH}/ok" -o "${MUSIC_DATA_PATH}/ok"
84
85 cat <<\EOF > "${MUSIC_DATA_PATH}/errok"
86 EOF
87
88 for method in point-to-point collective ; do
89 write_configuration "${method}"
90
91 run_test "${NP}" "${music_conf}"
92 exit_code=$?
93
94 if test "${exit_code}" -gt 0 ; then
95 exit "${exit_code}"
96 fi
97 done
98
99 exit 0