149 | | In the script above we request 20 cores on one node of Cypress (which is all the cores available on any node). As SLURM regards tasks as being analogous to MPI processes, it’s better to use the cpus-per-task directive when employing OpenMP parallelism. Additionally, the SLURM export variable $SLURM_JOB_CPUS_PER_NODE stores whatever value we assign to cpus-per-task, and is therefore our candidate for passing to OMP_NUM_THREADS. |
| 149 | In the script above we request 20 cores on one node of Cypress (which is all the cores available on any node). As SLURM regards tasks as being analogous to MPI processes, it’s better to use the cpus-per-task directive when employing OpenMP parallelism. Additionally, the SLURM export variable $SLURM_CPUS_PER_TASK stores whatever value we assign to cpus-per-task, and is therefore our candidate for passing to OMP_NUM_THREADS. |
| 150 | |
| 151 | === Hybrid Jobs === |
| 152 | |
| 153 | When running MPI/OpenMP hybrid jobs on Cypress, for example, |
| 154 | |
| 155 | {{{#!bash |
| 156 | #!/bin/bash |
| 157 | #SBATCH --qos=normal # Quality of Service |
| 158 | #SBATCH --job-name=hybridTest # Job Name |
| 159 | #SBATCH --time=00:10:00 # WallTime |
| 160 | #SBATCH --nodes=2 # Number of Nodes |
| 161 | #SBATCH --ntasks-per-node=2 # Number of tasks (MPI processes) |
| 162 | #SBATCH --cpus-per-task=10 # Number of threads per task (OMP threads) |
| 163 | |
| 164 | export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK |
| 165 | |
| 166 | mpirun ./myHybridExecutable |
| 167 | }}} |
| 168 | |
| 169 | In the script above we request 2 tasks per node and 10 cpus per task, which means 20 cores per node and all the cores available on one node. |
| 170 | We request 2 nodes so that we can use 4 MPI processes. Each process can use 10 OpenMP threads. |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | === MIC Native Jobs === |
| 178 | |
| 179 | There are two ''Intel Xeon Phi'' co-processors (MIC) on each node of Cypress. To run your code natively on MIC, make sure you have to compile the code with "-mmic" option. |
| 180 | The executable for MIC code cannot run on host CPU. To launch the MIC native executable from host, use "micnativeloadex" command. |
| 181 | SLURM jobscript script is, for example, |
| 182 | |
| 183 | {{{#!bash |
| 184 | #!/bin/bash |
| 185 | #SBATCH --qos=normal # Quality of Service |
| 186 | #SBATCH --job-name=nativeTest # Job Name |
| 187 | #SBATCH --time=00:10:00 # WallTime |
| 188 | #SBATCH --nodes=1 # Number of Nodes |
| 189 | #SBATCH --ntasks-per-node=1 # Number of tasks (MPI presseces) |
| 190 | #SBATCH --cpus-per-task=1 # Number of processors per task OpenMP threads() |
| 191 | #SBATCH --gres=mic:1 # Number of Co-Processors |
| 192 | |
| 193 | micnativeloadex ./myNativeExecutable -e "OMP_NUM_THREADS=100" -d 0 -v |
| 194 | }}} |
| 195 | |
| 196 | |
| 197 | |
| 198 | In the script above we request one MIC device that will be device number 0. |
| 199 | "micnativeloadex" command launches MIC native executable. "-e "OMP_NUM_THREADS=100"" option to set the number of threads on the MIC device to 100. |
| 200 | For more options, see below. |
| 201 | |
| 202 | {{{#!bash |
| 203 | [fuji@cypress01-090 nativeTest]$ micnativeloadex -h |
| 204 | |
| 205 | Usage: |
| 206 | micnativeloadex [ -h | -V ] AppName -l -t timeout -p -v -d coprocessor -a "args" -e "environment" |
| 207 | -a "args" An optional string of command line arguments to pass to |
| 208 | the remote app. |
| 209 | -d The (zero based) index of the Intel(R) Xeon Phi(TM) coprocessor to run the app on. |
| 210 | -e "environment" An optional environment string to pass to the remote app. |
| 211 | Multiple environment variable may be specified using spaces as separators: |
| 212 | -e "LD_LIBRARY_PATH=/lib64/ DEBUG=1" |
| 213 | -h Print this help message |
| 214 | -l Do not execute the binary on the coprocessor. Instead, list the shared library |
| 215 | dependency information. |
| 216 | -p Disable console proxy. |
| 217 | -t Time to wait for the remote app to finish (in seconds). After the timeout |
| 218 | is reached the remote app will be terminated. |
| 219 | -v Enable verbose mode. Note that verbose output will be displayed |
| 220 | if the remote app terminates abnormally. |
| 221 | -V Show version and build information |
| 222 | }}} |
| 223 | |
| 224 | |
| 225 | |
| 226 | |
| 227 | |