Skip to content

Marjorana

How to start Majorana Slurm+Shifter job executing arbitrary MJD code

ssh pdsf.nersc.gov
$sbatch batchShifter.slr
$  cat batchShifter.slr
#!/bin/bash
# Example provided by Clinton Wiseman, used public Docker image prepared by C.W. for MJD, runs arbitrary MJD code on PDSF or Cori
#SBATCH --image=wisecg/mjsw:v2
#SBATCH --workdir=/global/homes/w/wisecg/lat
#SBATCH --output=/global/homes/w/wisecg/lat/logs/shifter-%j.txt
#SBATCH -p shared
shifter  /bin/bash inShifterJob.sh ${@}

This example need adjustment of paths for every user.

The bash task script 'inShifterJob.sh' requires sourcing of your envirement - if you use Shifter

$  cat .inShifterJobsh
#!/bin/bash
# Here is a minimally working example. I set it up s/t I can pass arbitrary one-line commands to it, e.g.:  
#  sbatch batchShifter.slr './skim_mjd_data 1 1'
#  sbatch batchShifter.slr 'echo ABC'
echo "Job Start:"
date
echo "Node(s): "$SLURM_JOB_NODELIST
echo "Job ID: "$SLURM_JOB_ID
if [ -n "$SHIFTER_RUNTIME" ]; then
    echo "Shifter image active."
fi
# This runs whatever commands we pass to it.
echo "${@}"
time ${@}
echo "Job Complete:"
date

You can start Slurm job like this:

sbatch batchShifter.slr './skim_mjd_data 1 1'