Last modified: September 12, 2019

memory reservation

If your job uses more than 2GB RAM, then reserve adequate memory for it to finish. But PLEASE!! only reserve enough memory for your job to finish. Memory you reserve cannot be used by others, and there is a limited supply.

A job is terminated when there is insufficient memory (RAM) on a workstation. This may vary, depending on what other jobs are running.

determine memory requirement

The ‘qacct’ command prints information about completed SGE jobs, including memory usage. So if your job finished successfully in the past, then use ‘qacct’ to print how much memory it used:

$ qacct

You may print up to 1000 entries using the -n option (the default is ‘30’):

$ qacct -n 100

reserve memory

qsub

To reserve memory with qsub, use the qsub -l option, and replace <maxvmem> with the numeric value:

-l mem_free=<maxvmem>

For example, if the memory requirement (maxvmem) is 4G:

-l mem_free=4G
for more information about qsub, see:

submit

When using ‘submit’ to run jobs, create an options file with the memory reservation. For example, if the name of your options file is /home/lab/joe/sge-options’, and you want to reserve 43G of RAM, then you can run:

echo "-l mem_free=43G" >> /home/lab/joe/sge-options

When you run submit, specify the options file with ‘-o /home/lab/joe/sge-options’

For more information about submit, see https://www.neuro.berkeley.edu//resources/software/sge/scripting.html#submit

modify reservation

It’s impossible to change the reservation for running jobs, but you CAN change the memory reservation for jobs waiting in the queue. To do this, copy and paste the following command, and replace <maxvmem> with the value obtained from the qacct command:

for jobID in `qstat | grep qw | awk '{print $1}'`; do qalter -l mem_free=<maxvmem> $jobID; done

For example, if the memory reservation is 4G:

for jobID in `qstat | grep qw | awk '{print $1}'`; do qalter -l mem_free=4G $jobID; done

restricted access

A job may be terminated if there is insufficient memory available. When this happens, you will receive email to the address listed in the .forward file in your home directory ($HOME/.forward). Please keep this email address current.

If 3 or more jobs are terminated within 3 hours, then all your jobs will be terminated. You may resubmit your jobs, but only one job will run. This is to reduce the risk of system failure from insufficient memory.

If you don’t know how much memory a job needs, then submit a single job, and monitor it with the qstat command. When it’s finished, use the qacct command as described above.

After you change the memory reservation, email support@cirl.berkeley.edu to allow jobs in parallel.