-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqmachines
More file actions
49 lines (38 loc) · 1.08 KB
/
Copy pathqmachines
File metadata and controls
49 lines (38 loc) · 1.08 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
#!/bin/bash
if [ -z "$1" ]; then
echo -e "\
WARNING!!! Specify job id as the first argument.
Exiting..."
exit 1
fi
source $HOME/bin/skif-bin/.config/$(hostname | cut -d. -f1).nodes
jobid=$1
if [ -z "$(qstat -a | grep "\.$hostname" | grep "$jobid")" ]; then
echo -e "\
WARNING!!! Specified job id isn't correct.
Exiting..."
exit 2
fi
machines=.machines
nodes_list=$(qstat -a -n -1 | grep "$jobid" | awk '{print $NF}' | sed 's/+/\n/g' | cut -d/ -f1 | sort)
uniq_nodes_list=$(echo "${nodes_list}" | uniq)
uniq_nodes_num=$(echo "${uniq_nodes_list}" | wc -l)
kpar_block=""
for ((i=1; i<=${uniq_nodes_num}; i++)); do
unset kpar_node
kpar_node=$(echo "${uniq_nodes_list}" | head -$i | tail -1)
kpar_nodes=$(echo $(echo "${nodes_list}" | grep "${kpar_node}"))
if [ ! -z "${kpar_block}" ]; then
kpar_block="${kpar_block}
1:${kpar_nodes}"
else
kpar_block="1:${kpar_nodes}"
fi
done
machines_var="\
lapw0:$(echo $(echo "${nodes_list}" | head -${cores_per_node}))
${kpar_block}
granularity:1
extrafine:1"
echo "${machines_var}" > $machines
exit 0