There are plenty of SGE tutorials available in internet, however it is rare to find some description of environment variables in job script, here is a summary. When a Sun Grid Engine job is running, a number of variables are preset into the job?s script environment, as listed below.

  • ARC – The Sun Grid Engine architecture name of the node on which the job is running; the name is compiled-in into the sge_execd binary
  • COMMD_PORT – Specifies the TCP port on which sge_commd(8) is expected to listen for communication requests
  • SGE_ROOT – The Sun Grid Engine root directory as set for sge_execd before start-up or the default /usr/SGE
  • SGE_CELL – The Sun Grid Engine cell in which the job executes
  • SGE_JOB_SPOOL_DIR – The directory used by sge_shepherd(8) to store jobrelated data during job execution
  • SGE_O_HOME – The home directory path of the job owner on the host from which the job was submitted
  • SGE_O_HOST – The host from which the job was submitted
  • SGE_O_LOGNAME – The login name of the job owner on the host from which the job was submitted
  • SGE_O_MAIL – The content of the MAIL environment variable in the context of the job submission command
  • SGE_O_PATH – The content of the PATH environment variable in the context of the job submission command
  • SGE_O_SHELL – The content of the SHELL environment variable in the context of the job submission command
  • SGE_O_TZ – The content of the TZ environment variable in the context of the job submission command
  • SGE_O_WORKDIR – The working directory of the job submission command
  • SGE_CKPT_ENV – Specifies the checkpointing environment (as selected with the qsub -ckpt option) under which a checkpointing job executes
  • SGE_CKPT_DIR – Only set for checkpointing jobs; contains path ckpt_dir (see the checkpoint manual page) of the checkpoint interface
  • SGE_STDERR_PATH – The path name of the file to which the standard error
    stream of the job is diverted; commonly used for enhancing the output with error messages from prolog, epilog, parallel environment start/stop or checkpointing scripts
  • SGE_STDOUT_PATH – The path name of the file to which the standard output stream of the job is diverted; commonly used for enhancing the output with messages from prolog, epilog, parallel environment start/stop or checkpointing scripts
  • SGE_TASK_ID – The task identifier in the array job represented by this task
  • ENVIRONMENT – Always set to BATCH; this variable indicates that the script is run in batch mode
  • HOME – The user?s home directory path from the passwd file
  • HOSTNAME – The host name of the node on which the job is running
  • JOB_ID – A unique identifier assigned by the sge_qmaster when the job was
    submitted; the job ID is a decimal integer in the range to 99999
  • JOB_NAME – The job name, built from the qsub script filename, a period, and the digits of the job ID; this default may be overwritten by qsub -N
  • LOGNAME – The user?s login name from the passwd file
  • NHOSTS – The number of hosts in use by a parallel job
  • NQUEUES – The number of queues allocated for the job (always 1 for serial jobs)
  • NSLOTS – The number of queue slots in use by a parallel job