-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·60 lines (49 loc) · 1.2 KB
/
run.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
#!/usr/bin/env bash
set -eo pipefail
N_WORKERS=4
SUBSET_SIZE=1000
WHERE="local"
N_EPOCH=1000
POD_NAME="pod"
# parse arguments
while getopts ":n:s:w:e:p:" opt; do
case $opt in
# number of workers
n) N_WORKERS="$OPTARG";;
# subset size for stochastic sampling
s) SUBSET_SIZE="$OPTARG";;
# run locally or in cluster
w) WHERE="$OPTARG";;
# number of epoch
e) N_EPOCH="$OPTARG";;
# Pod name
p) POD_NAME="$OPTARG";;
\?) echo "Invalid option provided -$OPTARG" >&2
;;
esac
done
if [[ $WHERE = "cluster" ]];
then
echo "Deploy on cluster ..."
cd deploy && ./run-deploy.sh $N_WORKERS $SUBSET_SIZE $N_EPOCH $POD_NAME
exit 0
else
echo "run locally ..."
if ! ls ./resources/rcv1 1> /dev/null 2>&1;
then
echo "download dataset ..."
./download_data.sh
else
echo "dataset already present, skip download."
fi
# build app
sbt clean
sbt package
# submit to spark
spark-submit \
--class "com.github.yannbolliger.g5.parallel.sgd.spark.ParallelSGDApp" \
--master local[*] \
target/scala-2.11/*.jar \
$SUBSET_SIZE $N_EPOCH
exit 0
fi;