forked from kyamagu/sge-gpuprolog
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqstat
executable file
·30 lines (19 loc) · 950 Bytes
/
qstat
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
# Authors: Mozhgan Kabiri Chimeh, Paul Richmond
# Contact: [email protected]
#
# Startup script to allocate GPU devices.
# Based on https://github.com/kyamagu/sge-gpuprolog
#
# The script is written to emulate the 'qstat' command. It gets the number of GPUs as the JOB_ID and replaces it with the number of GPUs in 'userTest' file and echos it.
# Note that it gets environment varible that would normally be the $JOB_ID. We use the Job ID as the number of devices that qstat should return
# To execute, simply run qstat -j $2, where $2 would be the number of GPUs
NUM_GPUS=$2 # this is normaly the $JOB_ID, but here we are using it as the NUM_GPUS
# replaces the number of gpus already existed in the Twins qstat output with the one recieved from the user
replace_func(){
sed -i -e "s/gpu=[[:digit:]]/gpu=$NUM_GPUS/g" userTest
}
# Loop until all parameters are used up
if [ "$2" != "" ]; then
replace_func
fi
cat userTest