Skip to main content
Version: 2.0.0

Hello World

A minimal DMR application that shows how DMR reconfigurations work without transferring application data.

Source: the hello-world example repository.

What it does​

  1. Initialises MPI and DMR.
  2. Registers restart, checkpoint, and finalize hooks through DMR_AUTO.
  3. Uses a DMR policy to request reconfiguration.
  4. Prints which rank is running, checkpointing, restarting, or exiting.
  5. Stops after the configured number of reconfigurations.

The same source can be compiled and launched for DMR@Jobs, Slurm4DMR, or MiniDMR.

Prerequisites​

Clone or enter the example repository:

cd hello-world

The Makefile expects DMR_PATH to point to the DMR installation. The Slurm4DMR target also expects DLB_HOME.

Choose an execution mode​

DMR@Jobs uses the system Slurm instance. On MN5, use the pre-built DMR module:

module load dmr

Check that the module exported DMR_PATH:

echo "$DMR_PATH"

Compile:

make clean
make helloJobs

Configure the MN5 batch script (start_dmratjobs.sh):

#SBATCH --time=00:30:00
#SBATCH --exclusive
#SBATCH -N1
#SBATCH --qos=gp_bsccs
#SBATCH -A bsc85

export DMR_NODES_IN_EXPAND=1
export DMR_PROCS_PER_NODE=2

Run:

sbatch start_dmratjobs.sh

start_dmratjobs.sh builds the PRRTE host list from the Slurm allocation and launches:

$DMR_PATH/scripts/dmr_wrapper prterun --host "$NODELIST_WITH_COUNTS" ./hello-world

This mode uses TEST_POLICY. It expands to a new Slurm job, shrinks back down to a single job, and then terminates.

The exact node names and rank ordering depend on the allocation. The output should show rank 0 reporting the current reconfiguration count, ranks checkpointing/finalizing before they leave, restarted ranks joining the new allocation, and final Goodbye world lines when the configured reconfiguration count is reached. For example:

[1/4] Hello world from mc-slurmd-1. DMR's reconfiguration count is 0.
[1/8] Hello world from mc-slurmd-1. DMR's reconfiguration count is 1.
...
Goodbye world from rank 0 on mc-slurmd-1. DMR's reconfiguration count is 10.

Key points​

  • restart prints that the rank restarted; a real program would reload or rebuild its data.
  • checkpoint prints that the rank checkpointed; a real program would save or transfer data before reconfiguration.
  • finalize prints that the rank is about to exit; a real program would release resources.
  • DMR@Jobs uses an infinite wait loop because expansion requests are non-blocking by default.
  • During a reconfiguration, ranks call the checkpoint/finalize hooks before exiting, and restarted ranks call the restart hook after DMR relaunches the program.