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
Previous revision
doku:ompmpi [2014/08/12 10:18] irdoku:ompmpi [2021/05/13 17:47] (current) – removed goldenberg
Line 1: Line 1:
-====== Hybrid OpenMP/MPI jobs ====== 
-  
-===== Modifying the machine file ===== 
  
-Starting fewer MPI processes per node than slots available can be done in two different ways, 
-  - either by manually modifying the machine file  
-  - or by automatic modification through a parallel environment variable. 
- 
- 
-==== 1. Manually modifying the machine file ==== 
- 
-In cases where not all CPUs of one node are required, the machines file can be modified to guarantee the right behaviour of mpirun. The $TMPDIR/machines file on VSC-1 consists of a number of machine/node names. Each name stands for one CPU on the given machine/node. For an exclusive job on 2 nodes the machine file looks like: 
- 
-<code> 
-r10n01 
-r10n01 
-r10n01 
-r10n01 
-r10n01 
-r10n01 
-r10n01 
-r10n01 
-r12n10 
-r12n10 
-r12n10 
-r12n10 
-r12n10 
-r12n10 
-r12n10 
-r12n10 
-</code> 
- 
- 
-For running a job on less than eight cores the $TMPDIR/machines file has to be replaced within the job script: 
- 
-<code> 
-#$ -N test 
-#$ -pe mpich 16 
- 
-NSLOTS_PER_NODE_AVAILABLE=8 
-NSLOTS_PER_NODE_USED=4 
-NSLOTS_REDUCED=`echo "$NSLOTS / $NSLOTS_PER_NODE_AVAILABLE * $NSLOTS_PER_NODE_USED" | bc  ` 
- 
-echo "starting run with $NSLOTS_REDUCED processes; $NSLOTS_PER_NODE_USED per node" 
-for i in `seq 1 $NSLOTS_PER_NODE_USED` 
-do 
- uniq $TMPDIR/machines >> $TMPDIR/tmp 
-done 
-sort $TMPDIR/tmp  > $TMPDIR/myhosts 
-cat $TMPDIR/myhosts 
- 
- 
-mpirun -machinefile $TMPDIR/myhosts -np $NSLOTS_REDUCED sleep 2 
- 
-</code> 
- 
-The reduced form would look like: 
- 
-<code> 
-r10n01 
-r10n01 
-r10n01 
-r10n01 
-r12n10 
-r12n10 
-r12n10 
-r12n10 
-</code> 
- 
-==== 2. Automatic modification through parallel environment variable ==== 
- 
-Jobs using more than 2 GB per process can be executed in one of the parallel environments 
-  * mpich : 2 GB per process 
-  * mpich8: 4 GB per process 
-  * mpich4: 8 GB per process 
-  * mpich2: 16 GB per process 
-  * mpich1: 32 GB per process 
- 
-Please keep in mind that on VSC-2 jobs are node-exclusive and therefore your contingent of CPU-hours will be computed by full nodes and are therefore significantly more expensive. 
-For example, <code>qsub -pe mpich2 64 my_job.sh</code> requests 64 cores, each with 16 GB: this is fulfilled by 32 nodes: each hour of this job costs 32*16=512 CPU-hours. 
- 
- 
-== what to include in your jobscript == 
-<code>#$ -pe mpich2 4 
-mpirun -machinefile $TMPDIR/machines -np $NSLOTS_REDUCED -ppn 2 ./executable</code> 
-The parallel environment option (pe) includes the type of the requested environment (mpich2) and the number of processes (4). The number of processes per node (ppn) is 2. 
-The machine file and the variable NSLOTS_REDUCED are automatically modified such that they reflect the number of slots requested (4), whereas the variable NSLOTS is set to the number of physical cores allocated in the queueing system. This latter number NSLOTS corresponds to the cost calculation in the previous paragraph:  NSLOTS = 4 processes * 8 cores = 32 cores = 2 nodes. 
- 
-=== Hybrid MPI/OpenMP jobs === 
-<code>#$ -pe mpich2 4 
-export OMP_NUM_THREADS=8 
-mpirun -machinefile $TMPDIR/machines -np $NSLOTS_REDUCED -ppn 2 ./executable</code> 
-In this example, two nodes are reserved in the grid engine. On both nodes 2 processes each spanning 8 threads are started. 
  • doku/ompmpi.1407838714.txt.gz
  • Last modified: 2014/08/12 10:18
  • by ir