The application fails since it can’t find the file. I could put the full path to the file.in but I don’t want to hard code the path since I would like to submit from various directories and I don’t want all of the stdout and stderr files in my home dir.
I also tried to add this line in my ~/.bash_profile
if [ ! -z ${PBS_O_WORKDIR} ]; then cd $PBS_O_WORKDIR;fi
This works if I run the job interactively but not in batch.
Is there a submission flag I can use when submitting my job to start it in the right directory or is there a way that I can get it to load my ~/.bash_profile before the script is launched.
Looks like I found my answer in the user guide ;( Does anyone know the non easy way or is the answer to write a hook for this?
2.3.4 Submitting Jobs by Specifying Executable on Command Line
You can run a PBS job by specifying an executable and its arguments instead of a job script. When you run qsub this way, it runs the executable directly. It does not start a shell, so no shell initialization scripts are run, and execution paths and other environment variables are not set. There is not an easy way to run your command in a different directory. You should make sure that environment variables are set correctly, and you will usually have to specify the full path to the command.
To submit a job directly, you specify the executable on the command line:
For example, to run myprog with the arguments a and b:
To run myprog with the arguments a and b, naming the job JobA,
To use environment variables you define earlier: qsub [] – [] qsub – myprog a b qsub -N JobA – myprog a b
I wish PBSPro would steal an idea from torque. Torque’s qsub had a flag (-d) which would set the variable PBS_O_INITDIR. If -d wasn’t passed PBS_O_INITDIR defaulted to the user’s home directory.
Torque would always chdir() to $PBS_O_INITDIR immediately prior to invoking the jobscript. This was true for both interactive and batch jobs,
If PBSPro’s qsub had such an option you could have done: