-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathrun.sh
More file actions
64 lines (62 loc) · 1.61 KB
/
run.sh
File metadata and controls
64 lines (62 loc) · 1.61 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
#!/bin/bash
######################################################################
#
# A rudimentary Bash script.
# The `cpu mode` and `--auto_resume` are not supported.
#
# sh run.sh func.py task.yml expe.yml debug force_yml
# [Required] [Required] [Required] [Optional] [Optional]
#
######################################################################
python_path="python"
devices=0 # 0,1,2,3
num_devices=1
if [ -z "$4" ]; then
CUDA_VISIBLE_DEVICES="$devices" \
"$python_path" \
-u -m torch.distributed.run \
--nproc_per_node="$num_devices" \
--master_port=4001 \
"$1" \
-expe_opt "$2" \
-task_opt "$3" \
--launcher pytorch
else
if [ "$4" = "debug" ]; then
if [ -z "$5" ]; then
CUDA_VISIBLE_DEVICES="$devices" \
"$python_path" \
-u -m torch.distributed.run \
--nproc_per_node="$num_devices" \
--master_port=4001 \
"$1" \
-expe_opt "$2" \
-task_opt "$3" \
--debug \
--launcher pytorch
else
CUDA_VISIBLE_DEVICES="$devices" \
"$python_path" \
-u -m torch.distributed.run \
--nproc_per_node="$num_devices" \
--master_port=4001 \
"$1" \
-expe_opt "$2" \
-task_opt "$3" \
--debug \
--force_yml "$5" \
--launcher pytorch
fi
else
CUDA_VISIBLE_DEVICES="$devices" \
"$python_path" \
-u -m torch.distributed.run \
--nproc_per_node="$num_devices" \
--master_port=4001 \
"$1" \
-expe_opt "$2" \
-task_opt "$3" \
--force_yml "$4" \
--launcher pytorch
fi
fi