LogoDocumentation
Grid computingInfrastructure

Scratch storages

Scratch storage is a storage for temporary files for running job:

...                                  # PBS params etc.
cp -r ~/input_data_dir/ $SCRATCHDIR/ # copy data into a scratch directory
cd $SCRATCHDIR                          
...                                  # run the computing job

This storage should be used only during computations and should be freed immediately after your job ends.

The location of scratch directory is defined by a system variable SCRATCHDIR.

No default scratch

For a batch job, you must set the size and type of scratchdir! There is no default type of scratch. If you request no scratch at all, $SCRATCHDIR points to a plain directory on the node’s system disk (/var/tmp/pbs.<jobid>) — small and slow. Always ask for a scratch type and size explicitly.

Scratch types, the short version

You need…Scratch type to usePBS resource
Nothing special — a normal jobLocal scratch (default choice)scratch_local=10gb
Many small files / heavy reading and writingLocal SSD scratchscratch_ssd=10gb
Absolute maximum speed, small data, disposableScratch in RAMscratch_shm=true (+ large mem=)
Same files seen from many nodes of one multi-node jobShared scratchscratch_shared=10gb
Same big data reused by many separate jobs, nodes limited, I/O fastMultijob fast scratchmultijob=brno or multijob=plzen
Same big data reused by many separate jobs, everywhere, I/O slow is OKMultijob global scratchmultijob=global

Which scratch to use

Is the data only needed DURING one job?
├── yes, data are for a single job
│     ├── one node
│     │     ├── ordinary I/O ....................... scratch_local   (default)
│     │     ├── many files / heavy I/O ............. scratch_ssd
│     │     └── ultra fast I/O, moderate data ...... scratch_shm (+mem)
│     └── several nodes, shared files .............. scratch_shared
└── no, must survive between jobs
      ├── needs to be fast, nodes limited to Brno or Plzeň  . multijob=brno / multijob=plzen
      └── slow access acceptable, available on all nodes .... multijob=global

Scratch types - detailed overview

Scratch typePBS resourceSpeedDo data survive end of job?Path
Localscratch_localnormalno$SCRATCHDIR
Local SSDscratch_ssdfastno$SCRATCHDIR
in RAMscratch_shmultra fastno$SCRATCHDIR
Sharedscratch_sharedfastno$SCRATCHDIR
Shared scratch on Bee clusterscratch_shared AND cl_bee=Truefastyesdata was moved /scratch/multijob-brno
Multijob fastmultijobfastyesmanual, /scratch/multijob-[brno/plzen]
Multijob globalmultijobslowyesmanual, /scratch/multijob-global

Local scratch

The default choice.

  • PBS resource scratch_local
qsub -I -l walltime=01:00:00 -l select=1:ncpus=1:mem=1gb:scratch_local=400mb
  • Availability: on every node.
  • Speed: moderate (spinning HDD on most nodes).
  • Lifetime: the job. The content can be erased any time after job’s end.
  • Use it when: you have no special reason to use anything else — single-node jobs, ordinary data sizes, applications that read inputs once and write results once.

Fast SSD scratch

When disk speed is the bottleneck.

  • PBS resource scratch_ssd
qsub -I -l walltime=01:00:00 -l select=1:ncpus=1:mem=1gb:scratch_ssd=400mb
  • Availability: on most but not all nodes; see https://my.metacentrum.cz/machines -> choose a node -> search for “Scratch SSD”.
  • Speed: fast (SSD disc), smaller volume than local HDD scratch.
  • Lifetime: the job. The content can be erased any time after job’s end.
  • Use it when: the bottleneck is disc-related operations (applications that create/read a lot of files). If qstat -xf shows little CPU time used but long walltime, suspect I/O — try SSD.

Scratch in RAM

Maximum speed, zero safety.

  • PBS resource scratch_shm
qsub -I -l walltime=01:00:00 -l select=1:ncpus=1:mem=1gb:scratch_shm=true
  • Availability: on every node; scratch directory in RAM.
  • Size: maximum size of scratch is defined by the mem (memory) parameter. Remember to choose memory large enough (to hold both data in scratch and the actual memory requirements for the job)
  • Speed: as fast as a scratch can possibly get.
  • Lifetime: data on scratch do not survive the end/failure of the job.
  • Use it when: you need ultra-fast scratch AND when you absolutely don’t care about data from failed/killed/ended jobs

Shared scratch

A network volume shared between all nodes in a multi-node job.

  • PBS resource scratch_shared
qsub -I -l walltime=01:00:00 -l select=1:ncpus=1:mem=1gb:scratch_shared=400mb
  • Availability: not available on all computational nodes; to check for availability on a particular node, go to https://my.metacentrum.cz/machines -> choose a node -> search for “Scratch Shared”.
  • Speed: read/write operation slower than on local scratch.
  • Use it when: your job spans multiple nodes and the processes on different nodes must read/write the same files (e.g. MPI jobs with shared intermediate data, or job arrays where subjob N picks up what subjob N−1 left).

Multijob scratch fast

Reuse big data across jobs, fast, limited nodes.

Beta feature

This feature is currently in beta now. Currently available from skirit, skirit-lite, nympha and perian frontends.

Manual setup of scratchdir

PBS does not create the scratch directory; it only directs the job to the subset of machines that have connection to the already existing scratch either in Brno, or in Plzen. The multijob scratch requires a semi-manual setup: user first creates the scratchdir in a selected location, copies the data etc. In-between-jobs consistency of path to scratchdir must be kept manually by the user.

Data in fast multijob scratch are not backed up

Although the data in multijob scratch are not erased after the end of the job, multijob scratch is still a scratch: data are not backed up and in case of disc failure, they will be lost. Please keep this in mind and always keep a backup copy of your input data on your storage/Object storage.

  • PBS resource multijob=[ brno | plzen ]
qsub -I -l walltime=01:00:00 -l select=1:multijob=brno
  • located in /scratch/multijob-[brno|plzen]/USERNAME/

  • Availability: available only on some nodes located in Brno or Plzen with BeeGFS filesystem.

  • Speed: fast (BeeGFS parallel filesystem).

  • Lifetime: persistent scratch for independent consecutive jobs working on same data

  • Use it when: large masses of data (databases, reference datasets) that take long to copy and are shared by many independent jobs.

Example

# Run 1st job

qsub -I -l walltime=01:00:00 -l select=1:multijob=brno

(TRIXIE)user123@bee4:~$ cd /scratch/multijob-brno/user_123/
(TRIXIE)user123@bee4:~$ mkdir my_new_multijob_project
(TRIXIE)user123@bee4:~$ SCRATCHDIR=/scratch/multijob-brno/user_123/my_new_multijob_project/
# cp whatever data to SCRATCHDIR
# run the job no.1
(TRIXIE)user123@bee4:~$ exit

# Run another job on the same data

qsub -I -l walltime=01:00:00 -l select=1:multijob=brno # MUST be brno this time

(TRIXIE)user123@bee4:~$ SCRATCHDIR=/scratch/multijob-brno/user_123/my_new_multijob_project/
(TRIXIE)user123@bee4:~$ cd $SCRATCHDIR
# run the job no.2
(TRIXIE)user123@bee4:~$ exit

Multijob scratch global

Reuse big data across jobs, slow, on all nodes.

Manual setup of scratchdir

PBS does not create the scratch directory; in the case of multijob_global, the declaration currently serves for journaling purposes only.

Global multijob scratch is more resilient than fast multijob scratch

As the implementation and filesystem of global multijob scratch (CEPHfs) is different from the one used for fast multijob scratch (BeeGFS), the data in global multijob scratch are more resilient to disc failure. We recommend to prefer global multijob scratch for a series of jobs that you plan to submit over prologed period of time.

  • PBS resource multijob=global

  • submit as: qsub -I -l walltime=01:00:00 -l select=1:multijob=global

  • located in /scratch/multijob-global/USERNAME/

  • Availability: on every node.

  • Speed: low (CephFS filesystem).

  • Lifetime: persistent scratch for independent consecutive jobs working on same data

  • Use it when: suitable for jobs working on large masses of data (databases) which take long to copy to/from storage

Shared scratch on cluster Bee

Will be renamed soon

This scratch type has been discontinued by end of September 2026 in favour of multijob scratches. We keep this section for backwards reference only while the multijob scratches are in beta run.

BeeGFS (Beyond Extensible Enterprise File System) is a parallel distributed filesystem designed specifically for the needs of high-performance computing (HPC). It is used in computing clusters, scientific simulations, machine learning, genomics, and everywhere large datasets and fast parallel access are essential.

At MetaCentrum, we’ve adopted BeeGFS to meet the increasing challenges of data-intensive computations on data used by multiple job and/or job arrays. BeeGFS is available as a temporary working directory via the scratch_shared resource on cluster bee.cerit-sc.cz.

Main usecases:

  • PBS resource scratch_shared together with cl_bee=True,for example qsub -l walltime=1:0:0 -q default@pbs-m1.metacentrum.cz -l select=1:ncpus=1:mem=400mb:scratch_shared=400mb:cl_bee=True,
  • jobs with large files or a huge number of small files; BeeGFS efficiently handles massive datasets,
  • jobs with parallel I/O operation
  • jobs spanning multiple compute nodes
  • array jobs with intermediate results - BeeGFS is well-suited for workflows where subsequent computations can pick up intermediate results left in the scratch directory eliminating the need to copy data to permanent storage or run on the same machine as the previous step.

Read more on BeeGFS article on eInfra blog.

Cleaning scratch

Directory SCRATCHDIR is not writable, only it’s content is. Therefore, you cannot, e.g. do rm -rf $SCRATCHDIR, but you can rm -rf $SCRATCHDIR/*.

Users should always clear the content of the scratch directory after the job ends to free disc space. Otherwise, this directory will be automatically deleted after 14 days at most (earlier if there is lack of space on disks).

Examples

Submit batch job with 100 GB scratch on local disc:

qsub -l select=1:ncpus=1:mem=4gb:scratch_local=100gb

Submit the interactive job with 20 GB memory and scratch in RAM:

qsub -I -l select=1:ncpus=1:mem=20gb:scratch_shm=true

Submit batch job with 1 GB of scratch on SSD disc:

qsub -l select=1:ncpus=1:mem=4gb:scratch_ssd=1gb

System variables

SCRATCHDIR
    location of the scratch directory
    echo $SCRATCHDIR
SCRATCH_TYPE
    type of scratch directory
    echo $SCRATCH_TYPE
SCRATCH_VOLUME
    size of the scratch directory
    echo $SCRATCH_VOLUME

Last updated on

publicity banner

On this page

einfra banner