start:working_on_mogon:io_odds_and_ends:slurm_localscratch

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
start:working_on_mogon:io_odds_and_ends:slurm_localscratch [2020/10/19 13:53]
meesters [Signalling in SLURM -- difference between signalling submission scripts and applications]
start:working_on_mogon:io_odds_and_ends:slurm_localscratch [2020/10/19 13:57]
meesters [Copy files to multiple nodes via job script]
Line 105: Line 105:
  
 The following script can be used to ensure that input files are present in the job directory on **all** nodes.\\ The following script can be used to ensure that input files are present in the job directory on **all** nodes.\\
-This is required for e.g. [[software:namd2|NAMD2]], which in some cases reads input data on other nodes than the starting node. 
  
-This script is very verbose, you might want to delete or comment out the ''echo'' lines. +The demonstrated ''sbcast'' command can also be used for the one-node example above.
- +
-Also, this script copies data from **all** nodes back into separate directories named ''${SAVEDPWD}/${SLURM_JOB_NODELIST}/${host}''+
-\\If your application //only// needs to read on every node but does not write on every node, you want to use the cleanup function from the script posted above. The demonstrated ''sbcast'' command can also be used for the one-node example above.+
  
 <file bash job_multinode.sh> <file bash job_multinode.sh>
 #!/bin/bash #!/bin/bash
  
-#SBATCH -N 2 # assuming mogon I 'bulldozer' := 64 cores +#SBATCH -N 2  
-#SBATCH -J 'namd2_128' +use other parameterization as appropriate
-#SBATCH -p nodeshort +
-#SBATCH -mem 1800M+
  
 JOBDIR="/localscratch/${SLURM_JOB_ID}" JOBDIR="/localscratch/${SLURM_JOB_ID}"
-HOSTLIST=$(scontrol show hostname $SLURM_JOB_NODELIST | paste -d, -s | tr ',' ' ') 
-echo $HOSTLIST 
  
-# Store working directory to be safe 
-SAVEDPWD=$(pwd) 
-  
-# We define a bash function to do the cleaning when the signal is caught 
-cleanup() { 
-     sbcast ${JOBDIR}/resultfile ${SAVEDPWD}/${SLURM_JOB_ID}/resultfile 
-     exit 0 
-} 
-  
-# Register the cleanup function when SIGUSR2 is sent, 
-# ten minutes before the job gets killed 
-trap 'cleanup' SIGUSR2 
  
 # copy the input file on all nodes # copy the input file on all nodes
-sbcast ${HOME}/NAMD_2.9/apoa1.namd $JOBDIR/apoa1.namd +sbcast <somefile> $JOBDIR/<somefile>
-# some applications only need the file on the 'master' node +
-# in this case you can restrict yourself to: +
-cp ${HOME}/NAMD_2.9/apoa1.namd $JOBDIR/apoa1.namd+
  
-Go to jobdir and start the program +NOTE: Unlike 'cp' which accepts a directory and would assume that  
-cd "${JOBDIR}" +#       the destination file carries the same name, 'sbcast' 
-  +#       requires that a filename is given for the destination.
-$@ "${JOBDIR}/apoa1.namd"+
  
-# Call the cleanup function when everything went fine 
-cleanup 
 </file> </file>
  
-This script is used as follows: 
  
-<code bash> 
-$ chmod +x ./job_multinode.sh 
-$ namd2 # after loading the appropriate module 
-</code> 
  
  • start/working_on_mogon/io_odds_and_ends/slurm_localscratch.txt
  • Last modified: 2022/06/20 18:05
  • by meesters