Temporary directories ($TMPDIR)
In Linux the standard directory for temporary files is
/tmp
. For many applications this can be changed by setting
the environment variable $TMPDIR
. Specifying a
suitable TMPDIR
is an important optimization for programs
that make a lot of scratch I/O.
Contents
See also:
$TMPDIR in shell sessions and batch jobs
On Hummel-2 directories for temporary files are automatically created
and automatically deleted for every interactive session and every batch
job. The names of these directories are generated in the Environment
Module site/tmpdir
and kept in these environment
variables:
Variable | Explanation |
---|---|
$TMPDIR |
This variable is always defined. |
$RRZ_GLOBAL_TMPDIR |
Scratch directory in
/beegfs . |
$RRZ_LOCAL_TMPDIR |
Exists for Hummel-1 compatibility. Is set
to /tmp . |
Module site/tmpdir
is automatically loaded in
interactive session. In batch jobs it is loaded in:
source /sw/batch/init.[c]sh
Module site/tmpdir
sets variables in the following
way:
Environment | Settings |
---|---|
interactive session | TMPDIR=/beegfs/tmp/... RRZ_GLOBAL_TMPDIR=$TMPDIR RRZ_LOCAL_TMPDIR=$TMPDIR |
batch job | RRZ_GLOBAL_TMPDIR=/beegfs/scratch/...
RRZ_LOCAL_TMPDIR=/tmp TMPDIR=$RRZ_LOCAL_TMPDIR |
interaktive batch job
(salloc ) without source /sw/batch/init.[c]sh |
same as in interactive session
(variables are inherited) |
interaktive batch job
(salloc ) after source /sw/batch/init.[c]sh |
TMPDIR=/beegfs/tmp/... (taken
from session) RRZ_GLOBAL_TMPDIR=$TMPDIR RRZ_LOCAL_TMPDIR=/tmp |
Setting $TMPDIR for executing a single command with ssh
Commands that are specified on the ssh
command line do
not run in the usual login environment. As a consequence
$TMPDIR
is not defined.
If, for example, the default directory for temprary files
/tmp
is too small, $TMPDIR
can be created and
defined this way:
- create a sub-directory in your SSD directory
$
mkdir /places/$USER/ssd/tmpdir
- add these lines to your
$HOME/.bashrc
file
if [[ -z $TMPDIR ]] then export TMPDIR=/places/$USER/ssd/tmpdir fi
Note that there is no automatic deletion here and that space used in
this directory adds to your $SSD
disk quota.