PBS can specify the name of the output file with -o flag in the script. But can you use environment variables (or any variables) in the name of the file? When you use PBS to submit many jobs with the parameter sweep this would help to identify which output file contains results for a particular parameter variable.
(This is assuming TORQUE.)
No, not within the script’s #PBS header. They’re parsed before the shell script is run and it does not evaluate environment variables (see qsub_functions.c). The simplest way to do this would be to do multiple qsubs where the parameter was set outside the script, like:
for MYPARAM in a 1 c 2 e; do qsub -v MYPARAM -o job_$MYPARAM job.sh; done
or you could redirect standard output in your script with >
to a file named with a variable either set in your script or passed in with the -v
flag, like:
for MYPARAM in a 1 c 2 e 4; do qsub -v MYPARAM job.sh; done
and job.sh includes:
/user/myprogram $MYPARAM > $MYPARAM.txt
But please try to use job arrays with the -t
flag, if you are submitting N > 100 jobs at a time. TORQUE handles them much more efficiently.
Assuming Torque PBS, no in general but you can put in values of PBS environment variables known to the scheduler at job startup time. The only one that’s useful is the job #:
#PBS -o out.$PBS_JOBID