-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·69 lines (53 loc) · 1.56 KB
/
deploy.sh
File metadata and controls
executable file
·69 lines (53 loc) · 1.56 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
63
64
65
66
67
68
69
#!/usr/bin/env bash
# cluster deploy script. call with a list of all nodes on the command line,
# with the main node as the first arg.
#
# assumes you can currently access other nodes via ssh forwarding, but will
# create a new key and copy over to all others.
#
# example:
# $ deploy.sh repo-path node{0,1,2,3}
if [[ $# -lt 3 ]]; then
echo "Usage: $0 repo-path node0 [node1 ...]"
exit 1
fi
echo "Checking for public key..."
if ! ls ~/.ssh/*.pub; then
echo "No public key! Generate new."
ssh-keygen -t ed25519
fi
REPO_NAME=$1
shift
echo "Using repo $REPO_NAME"
cd $REPO_NAME || exit 1
ALL_NODES=$(python3 -c "print(','.join(input().split()))" <<< $@)
NUM_NODES=$#
echo "== $NUM_NODES nodes: $ALL_NODES"
MAIN_NODE=$1
echo "Main node is $MAIN_NODE"
shift
# Required by the `startmpc` script
ssh-copy-id -o StrictHostKeyChecking=no -i ~/.ssh/*.pub $MAIN_NODE
for W in "$@"; do
echo "== Minimal setup on node $W..."
ssh-copy-id -o StrictHostKeyChecking=no -i ~/.ssh/*.pub $W
# Run in the background
(scp -r $REPO_NAME/ $W:~/; ssh $W mkdir -p $REPO_NAME/build; ssh $W $REPO_NAME/scripts/_setup_required.sh) &
SSH_PIDS+=($!)
done
for pid in "${SSH_PIDS[@]}"; do
wait $pid
echo "Remote PID $pid done"
done
mkdir -p build
cd build
# setup on the host
../scripts/setup.sh
echo 'Testing MPI execution of `test_primitives`...'
cmake .. -DPROTOCOL=$NUM_NODES &&
make -j $(nproc) test_primitives
for W in "$@"; do
scp test_primitives $W:$REPO_NAME/build
done
mpirun --host $ALL_NODES -np $NUM_NODES test_primitives &&
echo 'Installation complete.'