Specifically, Cray requires a special command (aprun
) embedded within the qsub
request to execute the job on a batch node (Cray defaults to running on login/compute nodes without the aprun
syntax). When hand-keying a qsub
request to Cray Linux supercomputers, the directed syntax is:
qsub <qsub parameters> -V
aprun -n #CPUS /executable.exe param1 param2 ...
Ctrl-D
Where the user provides 'return' after the -V
(denoting passage of parameters in the qsub
statement) and after the executable/parameter set. Ctrl-D
terminates the input and executes the qsub/aprun
command.
The problem is, there are a variety of ways described on the net for inputting the Ctrl-D
(which simply means EOF
) in a BASH script, but none of them work in the context of the qsub
-embedded aprun
command.
What I need to do is execute this same syntax for multiple qsub/aprun
commands in a single script. How do I code this in BASH?
The solution syntax is:
qsub <qsub parameters> -V <<EOF
cd
aprun -n #CPUS /executable.exe param1 param2 ...
EOF
qsub <qsub parameters> -V <<EOF
cd
aprun -n #CPUS /executable.exe param1 param2 ...
EOF
Note the location of the <<EOF
(no space between << and EOF), the cd
is on a new line and followed by a newline with the aprun
syntax and the final EOF
in the set is without the leading <<
, followed by a newline.
This syntax will execute each qsub/aprun
command into a new batch node job submission. Output from the script will be the series of job IDs requested.