forked from flux-framework/flux-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
t2002-pmi.t
executable file
·115 lines (99 loc) · 3.82 KB
/
t2002-pmi.t
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/sh
#
test_description='Test that PMI works in a Flux-launched program
Test that PMI works in a FLux-launched program
'
. `dirname $0`/sharness.sh
if test "$TEST_LONG" = "t"; then
test_set_prereq LONGTEST
fi
# Size the session to one more than the number of cores, minimum of 4
SIZE=$(($(nproc)+1))
test ${SIZE} -gt 4 || SIZE=4
test_under_flux ${SIZE}
echo "# $0: flux session size will be ${SIZE}"
# Usage: run_program timeout ntasks nnodes
run_program() {
local timeout=$1
local ntasks=$2
local nnodes=$3
shift 3
export PMI_TRACE=0x38
run_timeout $timeout flux wreckrun -l -o stdio-delay-commit \
-n${ntasks} -N${nnodes} $*
}
test_expect_success 'pmi: wreck sets FLUX_JOB_SIZE' '
run_program 5 ${SIZE} ${SIZE} printenv FLUX_JOB_SIZE >output_size &&
test `wc -l < output_size` -eq ${SIZE} &&
test `cut -d: -f2 output_size | uniq` -eq ${SIZE}
'
test_expect_success 'pmi: wreck sets FLUX_TASK_RANK' '
run_program 5 4 4 printenv FLUX_TASK_RANK | sort >output_rank &&
cat >expected_rank <<-EOF &&
0: 0
1: 1
2: 2
3: 3
EOF
test_cmp expected_rank output_rank
'
# FIXME: this test hardwires the expectations that job ID's are
# assigned in a particular sequence. We don't really care about that,
# just that it's set to an integer that be returned by PMI_Get_appnum().
test_expect_success 'pmi: wreck sets FLUX_JOB_ID' '
run_program 5 ${SIZE} ${SIZE} printenv FLUX_JOB_ID >output_appnum &&
test `wc -l < output_appnum` = ${SIZE} &&
test `cut -d: -f2 output_appnum | uniq` -eq 3
'
test_expect_success 'pmi: wreck sets FLUX_LOCAL_RANKS multiple tasks per node' '
run_program 5 ${SIZE} 1 printenv FLUX_LOCAL_RANKS >output_clique &&
test `cut -d: -f2 output_clique | uniq` = `seq -s, 0 $((${SIZE}-1))`
'
test_expect_success 'pmi: wreck sets FLUX_LOCAL_RANKS single task per node' '
run_timeout 5 flux wreckrun -l -N4 printenv FLUX_LOCAL_RANKS \
| sort >output_clique2 &&
cat >expected_clique2 <<-EOF &&
0: 0
1: 1
2: 2
3: 3
EOF
test_cmp expected_clique2 output_clique2
'
test_expect_success 'pmi: (put*1) / barrier / (get*1) pattern works' '
run_program 10 ${SIZE} ${SIZE} \
${FLUX_BUILD_DIR}/src/test/tpmikvs >output_tpmikvs &&
grep -q "put phase" output_tpmikvs &&
grep -q "get phase" output_tpmikvs &&
test `grep PMI_KVS_Put output_tpmikvs | wc -l` -eq ${SIZE} &&
test `grep PMI_Barrier output_tpmikvs | wc -l` -eq $((${SIZE}*2)) &&
test `grep PMI_KVS_Get output_tpmikvs | wc -l` -eq ${SIZE}
'
test_expect_success 'pmi: (put*1) / barrier / (get*size) pattern works' '
run_program 30 ${SIZE} ${SIZE} \
${FLUX_BUILD_DIR}/src/test/tpmikvs -n >output_tpmikvs2 &&
grep -q "put phase" output_tpmikvs2 &&
grep -q "get phase" output_tpmikvs2 &&
test `grep PMI_KVS_Put output_tpmikvs2 | wc -l` -eq ${SIZE} &&
test `grep PMI_Barrier output_tpmikvs2 | wc -l` -eq $((${SIZE}*2)) &&
test `grep PMI_KVS_Get output_tpmikvs2 | wc -l` -eq $((${SIZE}*${SIZE}))
'
test_expect_success 'pmi: (put*16) / barrier / (get*16) pattern works' '
run_program 30 ${SIZE} ${SIZE} \
${FLUX_BUILD_DIR}/src/test/tpmikvs -N 16 >output_tpmikvs3 &&
grep -q "put phase" output_tpmikvs3 &&
grep -q "get phase" output_tpmikvs3 &&
test `grep PMI_KVS_Put output_tpmikvs3 | wc -l` -eq $((${SIZE}*16)) &&
test `grep PMI_Barrier output_tpmikvs3 | wc -l` -eq $((${SIZE}*2)) &&
test `grep PMI_KVS_Get output_tpmikvs3 | wc -l` -eq $((${SIZE}*16))
'
test_expect_success 'pmi: (put*16) / barrier / (get*16*size) pattern works' '
run_program 60 ${SIZE} ${SIZE} \
${FLUX_BUILD_DIR}/src/test/tpmikvs -n -N 16 >output_tpmikvs4 &&
grep -q "put phase" output_tpmikvs4 &&
grep -q "get phase" output_tpmikvs4 &&
test `grep PMI_KVS_Put output_tpmikvs4 | wc -l` -eq $((${SIZE}*16)) &&
test `grep PMI_Barrier output_tpmikvs4 | wc -l` -eq $((${SIZE}*2)) &&
test `grep PMI_KVS_Get output_tpmikvs4 | wc -l` -eq $((${SIZE}*16*${SIZE}))
'
test_done