The National Institute for Computational Sciences

General: How do I change my default limits for stack size, core file size, etc.?

When you connect to a system, your environment is set up with default limits for stack size, core file size, number of open files, etc. The system sets both soft and hard limits for these parameters. The soft limit is the actual limit imposed by the system. For example, the soft stack limit is the maximum stack size the system will allow a process to use. Users cannot increase their hard limits. Hard Limits can be decreased, but its not recommended.

While it is rarely necessary to change shell limits on Darter or Nautilus, there may be times when limits must be changed to get your program to run properly. However, users occasionally need to increase the default limits. This is where the hard limit becomes important. The system allows users to increase their soft limits, but it uses the hard limit as the upper bound. So, users cannot increase their soft limit to a value greater than their hard limit.

The command to modify limits varies by shell. The C shell (csh) and its derivatives (such as tcsh) use the limit command to modify limits. The Bourne shell (sh) and its derivatives (such as ksh and bash) use the ulimit command. The syntax for these commands varies slightly and is shown below. More detailed information can be found in the man page for the shell you are using.

Limit commands

Operationsh/ksh/bash commandcsh/tcsh command
View soft limitsulimit -S -alimit
View hard limitsulimit -H -alimit -h
Set stack size to 128 MB    ulimit -S -s 131072limit stacksize 128m


With any shell, you can always reset both soft and hard limits to their default values by logging out and back in.

On the Cray XT, both RLIMIT_CORE and RLIMIT_CPU limits are always forwarded to the compute nodes. If you wish to set any other user resource limits, you must set APRUN_XFER_LIMITS environment variable to 1 along the new limits within the job script before the aprun call:



Default user resource limits

The default user resource limits in the compute nodes are:

time(seconds)        unlimited
file(blocks)         unlimited
data(kbytes)         unlimited
stack(kbytes)        unlimited
coredump(blocks)     0
memory(kbytes)       unlimited
locked memory(kbytes) 512
process              unlimited
nofiles              1024
vmemory(kbytes)      unlimited
locks                unlimited