-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclustercheck.sh
More file actions
62 lines (52 loc) · 1.2 KB
/
clustercheck.sh
File metadata and controls
62 lines (52 loc) · 1.2 KB
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
cd ~/CURI2021-Raspberry-Pi
#creating the head-node and the host file
sudo head-node
#Running multiple subshells, because some commands end the script
#Subshell 1: Running soc-mpisetup
(
sudo su hd-cluster << "EOF"
cd ~
soc-mpisetup
EOF
)
#Subshell 2: Running the MPI job
(
sudo su hd-cluster << "EOF"
cd ~
#Testing Cluster on MPI/00.spmd patternlet
echo "MPI cluster testing"
cd ~/CSinParallel/Patternlets/MPI/00.spmd/ && make 2>> ~/err.txt > /dev/null
#Run the job
mpirun -hostfile ~/hostfile -np 12 ./spmd 2>> ~/err.txt 1>> ~/outtest.txt
EOF
)
#Subshell 3: Checking the output
(
sudo su hd-cluster << "EOF"
cd ~
#Cleanup the files
rm ~/CSinParallel/Patternlets/MPI/00.spmd/spmd
rm ~/hostfile
rm ~/.openmpi/mca-params.conf
#checking for desired output
clusterWork=true
while IFS= read -r line
do
if ! grep "$line" ~/outtest.txt > /dev/null
then
echo -e "\e[1;31mFOLLOWING LINE NOT DETECTED: $line \e[0m"
clusterWork=false
fi
done < /home/pi/CURI2021-Raspberry-Pi/clustercheck.txt
#Output
if $clusterWork
then
echo -e "\e[1;32mCluster testing showed no errors \e[0m"
rm ~/outtest.txt
rm ~/err.txt
else
echo -e "\e[1;31mTESTING THE CLUSTER RESULTED IN ERROR\e[0m"
fi
EOF
)