NCSA Home
Contact Us | Intranet | Search

core files

Applications built with the Intel Fortran compiler should set the decfort_dump_flag environment variable to y,Y, or true in order to get a better core file.

       setenv decfort_dump_flag y

Core file creation is controlled by the default shell [usually csh or tcsh] with the limit command [for bash or sh, see ulimit -c in the bash or sh man page]. While some systems may restrict the creation of core files by setting the hard limit to 0 on login hosts, batch jobs are typically allowed to create core files. From "man csh":

       limit [-h] [resource [maximum-use]]
               Limits  the consumption by the current process and each process
               it creates to not individually exceed maximum-use on the speci-
               fied  resource.   If  no maximum-use is given, then the current
               limit is printed; if no resource is given, then all limitations
               are  given.   If the -h flag is given, the hard limits are used
               instead of the current limits.  The hard limits impose a  ceil-
               ing  on  the values of the current limits.  Only the super-user
               may raise the hard limits, but a user may lower  or  raise  the
               current limits within the legal range.

               coredumpsize
                      the size of the largest core dump that will be created

Here's an example showing a change of the coredumpsize limit from "unlimited" to 100000 K [about 100MBytes] in an interactive shell. The commands are shown in bold. You might want to have a limit on coredumpsize to keep from going over disk quota on your home directory. If the limit is 0, you may want to increase it so that a core file is created if you're trying to debug a program that crashes. Corefile limits can be easily set in your $HOME/.cshrc file by using the limit coredumpsize command shown.

	[arnoldg@tunc ~]$ limit
	cputime         unlimited
	filesize        unlimited
	datasize        unlimited
	stacksize       10240 kbytes
	coredumpsize    unlimited
	memoryuse       unlimited
	vmemoryuse      unlimited
	descriptors     1024
	memorylocked    4 kbytes
	maxproc         7168
	[arnoldg@tunc ~]$ limit coredumpsize 100000
	[arnoldg@tunc ~]$ limit coredumpsize
	coredumpsize    100000 kbytes
	[arnoldg@tunc ~]$
That change could be made persistent for each new shell by adding it to your .cshrc file:
	[arnoldg@tunc ~]$ echo "limit coredumpsize 100000" >> $HOME/.cshrc

linux core file location and naming

If your program indicates a core file was created with "core dumped", but it's not in the working directory, inspect /proc/sys/kernel/core_pattern. Core files can be redirected to alternate directories and named in custom ways by the staff that setup the system. From "man proc" :

       /proc/sys/kernel/core_pattern
              This  file  (new  in Linux 2.5) provides finer control over the
              form of  a  core  filename  than  the  obsolete  /proc/sys/ker-
              nel/core_uses_pid  file  described  below.  The name for a core
              file is controlled by defining  a  template  in  /proc/sys/ker-
              nel/core_pattern.   The template can contain % specifiers which
              are substituted by the following values when  a  core  file  is
              created:

                %%  A single % character
                %p  PID of dumped process
                %u  real UID of dumped process
                %g  real GID of dumped process
                %s  number of signal causing dump
                %t  time of dump (secs since 0:00h, 1 Jan 1970)
                %h  hostname (same as the ’nodename’
                    returned by uname(2))
                %e  executable filename

              A  single % at the end of the template is dropped from the core
              filename, as is the combination of a % followed by any  charac-
              ter other than those listed above.  All other characters in the
              template become a literal part of the core filename.  The maxi-
              mum  size  of  the  resulting  core  filename is 64 bytes.  The
              default value in this file is "core".  For backward compatibil-
              ity, if /proc/sys/kernel/core_pattern does not include "%p" and
              /proc/sys/kernel/core_uses_pid is non-zero, then .PID  will  be
              appended to the core filename.

       /proc/sys/kernel/core_uses_pid
              This file can be used control the naming of a core dump file on
              Linux 2.4.  If this file contains the value 0, then a core dump
              file  is  simply  named core.  If this file contains a non-zero
              value, then the core dump file includes the  process  ID  in  a
              name of the form core.PID.