Skip to content

slurm support #181

@rjleveque

Description

@rjleveque

There was a recent question on the claw-users mailing list about sample slurm scripts for running Clawpack or GeoClaw on cluster or HPC, and it would be nice to include some examples. @mandli pointed to this code: https://github.com/mandli/batch.

Personally I have used a script similar to this sample, if I want to do a single run using 6 OpenMP threads, for example:

#!/bin/bash

# JOB NAME
#SBATCH --job-name=run-geoclaw

# ALLOCATION DEFINITION
#SBATCH --account=tsunami
#SBATCH --partition=compute

# RESOURCES
#SBATCH --nodes=1  # total number of nodes allocated
#SBATCH --ntasks-per-node=6

# WALL TIME
#SBATCH --time=10:00:00

# MEMORY PER NODE
#SBATCH --mem=58G

# WORKING DIRECTORY ENTRYPOINT
# Specify the working directory for this job
#SBATCH --output=job-geoclaw.%j.out
#SBATCH --error=job-geoclaw.%j.err

# Run the commands to run your program here
# e.g. load modules, copy input.output files, run program, etc.

module load intel/oneAPI/2021.1.1

# Export all environment variables to the batch job session
#SBATCH --export=all

# Set or reset any environment variables here:
source $HOME/.bashrc   # needed for conda setup
export FC=ifort
export FFLAGS='-O2 -qopenmp'
export OMP_NUM_THREADS=6
export CLAW=/gscratch/tsunami/clawpack-v5.12.0
export PYTHONPATH=$CLAW:$PYTHONPATH
export EXE=$CLAW/xgeoclaw

date
pwd
conda activate /gscratch/tsunami/miniconda3/envs/geo5
make all              # makes scratch dir, data, output, plots
python plot_fgmax.py  # post-processing the fgmax output
date

Instead of doing a single run as in the example above, I often run a Python script along the lines of what was merged in v5.12.0 in this PR: #180. This is still work in progress and there may be better ways to do the multiprocessing, but at any rate if I set e.g. nprocs = 8 in that code to run 8 jobs in parallel and want to use 5 OpenMP threads for each, I would set

#SBATCH --ntasks-per-node=40
...
export OMP_NUM_THREADS=5
...
python run_cases_clawpack.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions