• Zur Metanavigation
  • Zur Hauptnavigation
  • Zur Suche
  • Zum Inhalt
  • Zur Subnavigation
  • Zum Seitenfuß
  • University of Hamburg
  • For journalists
  • Staff Service Portal0
  • STiNE
https://www.kus.uni-hamburg.de/aktuelles.json?recentnews=true
  • Institutions and target groups
    • Einrichtungen
      • Faculties

        • Faculty of Law
        • Faculty of Business, Economics and Social Sciences
        • Faculty of Medicine
        • Faculty of Education
        • Faculty of Humanities
        • Faculty of Mathematics, Informatics and Natural Sciences
        • Faculty of Psychology and Human Movement Science
        • University of Hamburg Business School
      • Services

        • Study Information Net STiNE
        • Surfmail
        • Exchange
        • Staff Service Portal
        • Learning Platforms
        • Katalogplus – Catalogue of Hamburg Libraries
        • SharePoint
      • Student facilities and services

        • Campus Center
        • Career Center
        • PIASTA
        • AStA (student council)
        • University Sports
        • University Music
        • Family Office
        • University Language Center
        • General Languages
        • Office of Affairs for Students with Disabilities or Chronic Diseases
        • Departmental libraries
        • Healthy Campus
      • Further facilities and services

        • The Cluster of Excellence CLICCS
        • The Cluster of Excellence CUI
        • The Cluster of Excellence Quantum Universe
        • The Cluster of Excellence Understanding Written Artefacts
        • Hamburg Research Academy
        • Pier Plus
        • Hamburg Center for University Teaching and Learning (HUL)
        • Hub for Crossdisciplinary Learning (HCL)
        • CEN
        • Museums and collections
        • University Archives (in German)
        • Regional Computing Center (RRZ)
        • University Administration
        • Knowledge Exchange Agency
        • The Unikontor Shop (in German)
    • Target groups

      • Prospective students
      • Students
      • International prospective students
      • Young researchers
      • Researchers
      • Instructors
      • Staff
      • Prospective continuing education students
      • Alumni
      • Journalists
      • Refugees (in German only)
    Close
  • /en/sitemap.json
University of Hamburg - to research, to teach, to educate and form, to homepage

RRZ

Regional Data Center
(RRZ)
  • Support
    • RRZ-ServiceLine/STiNE-Line
    • RRZ-ServiceDesk
    • RRZ-ServicePortal
    • RRZ Feedback
    • RRZ Portfolio
    • Application Forms
    • Instructions/Glossary
    • FAQ
    • Policies
    • Support Forms
  • Services
  • ID & Authentication
    • Apply for an identifier
    • Forgotten/change password
    • Set up two-factor authentication
    • Managing identifier groups (group manager)
  • Innovation
    • Research & Education
    • Organisational Development
  • About Us
    • RRZ News
    • Mission statement
    • Map / Directions
    • Operating Hours / Opening Hours
    • RRZ Staff
    • Careers
    • Organizational Structure
    • Webinars
    • Equal Opportunity at the RRZ
    • History of the RRZ

Photo: Thomas Orgis

  1. UHH
  2. RRZ
  3. Services
  4. HPC
  5. Hummel-2
  6. batch
  7. examples
  8. first

First test jobs

This page contains two batch job examples, that can be used to get started with batch processing:

  • First Slurm job job which could be run on any SLURM installation.

  • First Hummel-2 jobs which has the properties of all batch jobs to be run on Hummel-2.

First Slurm job

This job is generic, i.e. it contains nothing that is specific to Hummel-2. It contains resource specifications (--ntasks and --time) and one command (echo).

line
no.
/sw/batch/examples/first-test-jobs/first-slurm-job.sh
1
2
3
4
5
6
7
8
9
#!/bin/bash
#SBATCH --ntasks=1
#SBATCH --time=00:01:00

# This batch job should run on every Slurm batch system.

echo "Hello, world!"

exit

First Hummel-2 job

This job has all characteristic properties of a batch job to be run on Hummel-2:

  • First of all it is a parallel job. It has the smallest possible job size which is 8 CPU cores.
  • The recommended submit option –export=NONE is set.
  • The recommended initialization source /sw/batch/init.sh is included.

The job uses the srun command for demonstration purpose. (OpenMP programs do not need srun. MPI programs shall be started with mpirun.)

line
no.
/sw/batch/examples/first-test-jobs/first-hummel2-job.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
#
# Do not forget to select a proper partition and account if the
# default one is no fit for the job! You can do that with environment
# variables SBATCH_PARTITION and SBATCH_ACCOUNT, in the sbatch command
# line or here with the other #SBATCH settings.
#
# Never forget "--export=NONE" and "source /sw/batch/init.sh" !
# Strange happenings ensue otherwise.
#
#SBATCH --job-name=hello
#SBATCH --ntasks=8
#SBATCH --time=00:10:00
#SBATCH --export=NONE

source /sw/batch/init.sh

# Load environment modules for your application here.

# Useful settings:
set -e  # Stop operation on first error.
set -u  # Treat undefined variables as an error.
set -x  # Print command lines as they are executed.

# Actual work starting here. You might need to call mpirun for MPI
# programs or srun depending on your type of application for proper
# parallel work.  Examples of simple commands (that might themselves
# handle parallelisation):
echo "Hello World! I am node $(hostname -s) greeting you!"
echo "Also, my current TMPDIR is $TMPDIR"

# Let's pretend our started processes are working on a predetermined
# parameter set, and are finding their specific parameters using the
# set number and the process number inside the batch job:
export PARAMETER_SET=42

# Simplest way to run an identical command on all allocated
# cores. Environment variables can be used to tell apart the
# instances:
srun bash -c 'echo "process $SLURM_PROCID \
   (out of $SLURM_NPROCS total) on $(hostname -s), \
   parameter set: $PARAMETER_SET"'

# Demonstration of process binding: each "grep" uses
# only the CPU core printed:
srun --cpu-bind=cores grep Cpus_allowed_list: /proc/self/status

exit

The commands for trying this batch job are:

shell$ cd $BEEGFS
shell$ sbatch /sw/batch/examples/first-test-jobs/first-hummel2-job.sh 
Submitted batch job 12345
shell$ cat slurm-12345.out 
module: loaded site/slurm
module: loaded site/tmpdir
module: loaded site/hummel2
module: loaded env/system-gcc
++ hostname -s
+ echo 'Hello World! I am node n123 greeting you!'
Hello World! I am node n123 greeting you!
+ echo 'Also, my current TMPDIR is /tmp'
Also, my current TMPDIR is /tmp
+ export PARAMETER_SET=42
+ PARAMETER_SET=42
+ srun bash -c 'echo "process $SLURM_PROCID \
   (out of $SLURM_NPROCS total) on $(hostname -s), \
   parameter set: $PARAMETER_SET"'
process 5    (out of 8 total) on n123,    parameter set: 42
process 0    (out of 8 total) on n123,    parameter set: 42
process 4    (out of 8 total) on n123,    parameter set: 42
process 1    (out of 8 total) on n123,    parameter set: 42
process 2    (out of 8 total) on n123,    parameter set: 42
process 6    (out of 8 total) on n123,    parameter set: 42
process 3    (out of 8 total) on n123,    parameter set: 42
process 7    (out of 8 total) on n123,    parameter set: 42
+ srun --cpu-bind=cores grep Cpus_allowed_list: /proc/self/status
Cpus_allowed_list:      160
Cpus_allowed_list:      161
Cpus_allowed_list:      162
Cpus_allowed_list:      163
Cpus_allowed_list:      164
Cpus_allowed_list:      165
Cpus_allowed_list:      166
Cpus_allowed_list:      167
+ exit
  • getting access
  • quick start
  • migration from Hummel
  • hardware
  • working with data
  • software
  • running batch jobs
    • example batch jobs
      • batch job structure
      • first test jobs
        • std partition
        • big partition
        • gpu partition
        • batch jobs with jobber
      • job chains
    • RRZ tools
    • acknowledgements

    Last update: 23 October 2024

    • Feedback
    • Legal notice
    • Privacy statement
    • Accessibility
    • Site map

    University of Hamburg

    Innovating and Cooperating for a Sustainable Future in a Digital Age

    • Follow us on Instagram.
    • Follow us on Facebook.
    • Connect with us on LinkedIn.
    • Follow us on Mastodon.
    • Follow us on Bluesky.
    • Subscribe to our channel on YouTube.
      • Studies
      • Prospective students
      • Continuing education
      • Research
      • Teaching at UHH
      • Doctoral studies
      • Job opportunities
      • Knowledge exchange
      • University
      • Excellence
      • Faculties
      • Alumni
      • Contact
      • Campus Navigator
      • UHHApp
      • Emergencies, safety and security
      • Antidiscrimination
    Go to family-friendly higher education institution audit
    Go to internationalisation re-audit
    Go to the Sustainability Audit page
    Go to Diversity Audit
    Go to System accreditation

    © 2026 University of Hamburg. All rights reserved