forked from awslabs/libfabric-ci-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmpi_ring_c_test.sh
62 lines (53 loc) · 1.47 KB
/
mpi_ring_c_test.sh
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
#!/bin/bash
source ~/.bash_profile
source ~/mpi_common.sh
source ~/wget_check.sh
set -x
set -o pipefail
mpi=$1
shift
libfabric_job_type=$1
shift
provider=$1
shift
hosts=$@
hostfile=$(mktemp)
out1=$(mktemp)
out2=$(mktemp)
wget_check "https://raw.githubusercontent.com/open-mpi/ompi/master/examples/ring_c.c" "ring_c.c"
wget_check "https://raw.githubusercontent.com/open-mpi/ompi/master/examples/ring_usempi.f90" "ring_usempi.f90"
if [ "${mpi}" == "ompi" ]; then
ompi_setup "${provider}"
elif [ "${mpi}" == "impi" ]; then
impi_setup "${libfabric_job_type}"
else
echo "unknown mpi type"
exit 1
fi
host_setup ${hostfile} ${hosts}
mpicc -o /tmp/ring_c ring_c.c
# Fortran compile test
mpif90 -o /tmp/ring_fortran ring_usempi.f90
for host in $hosts; do
scp /tmp/ring_c $host:/tmp
scp /tmp/ring_fortran $host:/tmp
done
$mpirun_cmd --version
$mpirun_cmd -n $(( $ranks * $# )) -hostfile $hostfile /tmp/ring_c 2>&1 | tee $out1
if [ $? -ne 0 ] || ! grep -q "Process 0 exiting" $out1; then
echo "mpirun ring_c failed"
exit 1
fi
$mpirun_cmd -n $(( $ranks * $# )) -hostfile $hostfile /tmp/ring_fortran 2>&1 | tee $out2
if [ $? -ne 0 ] || ! grep -q "Process 0 exiting" $out2; then
echo "mpirun ring_fortran (f90) failed"
exit 1
fi
if [ "${mpi}" == "ompi" ] && [ "$provider" == "efa" ]; then
check_efa_ompi $out1
check_efa_ompi $out2
elif [ "${mpi}" == "impi" ] && [ "$provider" == "efa" ]; then
check_efa_impi $out1
check_efa_impi $out2
fi
echo "Test Passed"