-
Notifications
You must be signed in to change notification settings - Fork 2
/
ray-launch.sh
executable file
·73 lines (65 loc) · 1.67 KB
/
ray-launch.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
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
#
# Script to simplify submission of ray-janelia.sh to the cluster.
#
# Usage example:
#
# ./ray-launch.sh -n 20 -e ray-python -p "/path/to/job.py --options"
#
DIR=$(cd "$(dirname "$0")"; pwd)
while getopts "n:e:d::m::o::p::b::h" option;do
case "${option}" in
n) n=${OPTARG}
slots=$n
;;
e) e=${OPTARG}
conda_env=$e
;;
d) d=${OPTARG}
nodes=$d
;;
m) m=${OPTARG}
object_store_mem=$m
;;
o) o=${OPTARG}
output_file=$o
;;
p) p=${OPTARG}
python_command=$p
;;
b) b=${OPTARG}
bsub_opts=$b
;;
h) echo "Usage: $0 -n slots -e conda-env-name [-d num-nodes] [-m object-store-bytes] [-o output-file] [-p python-command] [-b bsub-options]"
exit 1
;;
esac
done
if [ -z "$slots" ]; then
echo "Use -n to provide the number of slots you want for your cluster."
exit 1
fi
if [ -z "$conda_env" ]; then
echo "Use -e to provide the name of a conda environment with ray installed."
exit 1
fi
ptile=4
if [ -n "$nodes" ]; then
ptile=$(( slots / nodes ))
echo "Using tiling of $ptile slots per node"
else
echo "Using default tiling of 4 slots per node"
fi
if [ -z "$object_store_mem" ]; then
echo "Using default object store mem of 4GB. Make sure your cluster has more than 4GB of memory."
object_store_mem=4000000000
fi
if [ -z "$output_file" ]; then
output_file="std%J.out"
fi
command_str=""
if [ -n "$python_command" ]; then
command_str="-c python $python_command"
fi
bsub -o $output_file -e $output_file -n $slots -R "span[ptile=$ptile]" $bsub_opts \
bash -i $DIR/ray-janelia.sh -n $conda_env -m $object_store_mem "$command_str"