Dezhi DaiEnjoy the Colorful Fluid Dynamics!2020-05-20T02:23:35.168Zhttp://ddai.me/Dezhi DaiHexoA Slurm script generator for running OpenFOAM jobs in HPC clustershttp://ddai.me/10/06/2018/a-slurm-script-generator-for-running-openfoam-jobs-in-hpc-clusters/2018-10-07T00:41:28.000Z2020-05-20T02:23:35.168Z
Introduction
The Slurm (aka Simple Linux Utility for Resource Management or SLURM) job scheduler is employed by many of the HPC clusters. It is annoying when modifying the Slurm script for OpenFOAM parallel cases. Then, a Slurm script generator based on the Bash language has been developed.
Slurm Script Generator
The Bash commands shown below will generate a Slurm job script which requests a parallel job with 32 threads spread over 2 node and 12 hours. Some individual items, e.g., email, flow_solver or proj, need to be modified before running the generator.
#-------------------------------------------------------------------- # Slurm script generator for running OpenFOAM cases on HPC clusters. # # Note: # Please put this file in the root directory of the case.
# Author: # Dezhi Dai (dezhi.dai@mavs.uta.edu), MAE Department, UTA. #--------------------------------------------------------------------
#-Modify this part if needed----------------------------------------- # Set the email, replace this by your own email address email="xxx@xxx" # Set the flow solver flow_solver="xxxFoam" # Set the No. of nodes requested and total mpi tasks n_nodes="2" n_mpis="32" # Set the project to charge proj="xxx" # Set request time time_request="12:00:00" #--------------------------------------------------------------------
# Obtain current case directory and rootcase name case_dir=`pwd` case_name=`basename "$case_dir"` # Set the file name of the SLURM job script s_name="auto_slurm_job"
# Write options and commands to the Slurm script # Header echo"#!/bin/bash" > $s_name
It should be noted that the reconstructPar utility only support a serial job, which means it will waste your Service Unit budget if you run it in a parallel request.
Usage
The usage of the generator is simple. Save the commands as xxxx (any name you like) and run the following commands in the terminal: