Difference between revisions of "Parallel job submission"

From ScientificComputing
Jump to: navigation, search
Line 13: Line 13:
 
</tr>
 
</tr>
 
</table>
 
</table>
 +
  
 
== Shared memory job (OpenMP) ==
 
== Shared memory job (OpenMP) ==
* Runs on a single compute node
+
<table>
* Can use up to 24 processors
+
<tr valign=top>
* Number of processors must be defined in $OMP_NUM_THREADS
+
<td style="width: 35%; background: white;">
 +
<br>
 +
[[Image:shared_memory_computing.png|300px]]
 +
<br>
 +
</td>
 +
<td style="width: 60%; background: white;">
 +
* In shared-memory parallel computing, multiple processors (or "threads") perform tasks independently but share a common global memory. If a processor modified an array in the memory, all other processors can see this update as well
 +
* A serial code can be parallelized by marking code sections, which should be run in parallel, with [https://www.openmp.org/ openMP directives].
 +
* An openMP code can run on a single compute node and use up to maximum number of processors in that compute node, e.g., 24, 36, or 128 processors.
 +
* To run an openMP code, define number of processors(threads) in $OMP_NUM_THREADS
 +
 
 +
$ export OMP_NUM_THREADS=8
 +
$ bsub -n 8 ./program
 +
</td>
 +
</tr>
 +
</table>
  
export OMP_NUM_THREADS=8
 
bsub -n 8 ./program
 
  
 
== Distributed memory job (MPI) ==
 
== Distributed memory job (MPI) ==
* Runs on multiple compute nodes
+
<table>
* Can use tens or even hundreds of processors
+
<tr valign=top>
* Program must be launched using mpirun
+
<td style="width: 35%; background: white;">
 +
<br>
 +
[[Image:distributed_memory_computing.png|300px]]
 +
<br>
 +
</td>
 +
<td style="width: 60%; background: white;">
 +
* In distributed-memory parallel computing, multiple processors (or "cores") perform tasks independently while each processor possesses its own private memory resource. If a processor modify an array in its memory, this processor has to communicate to other processors so that the others see this update.
 +
* Massage Passing Interface (MPI) library implements distributed memory parallel computing which can be programmed in C, C++ and Fortran
 +
* An MPI program can run on a single compute node as well as on multiple compute nodes
 +
* An MPI program must be launched using "mpirun"
 +
 
 +
$ module load gcc/6.3.0 openmpi/4.0.2
 +
$ bsub -n 240 mpirun ./program
 +
 
  
module load compiler
+
</td>
module load mpi_library
+
</tr>
bsub -n 240 mpirun ./program
+
</table>
  
 
== Example ==  
 
== Example ==  

Revision as of 14:27, 3 June 2021

< Submit a job

Home

Monitor a job >


Shared memory job (OpenMP)


Shared memory computing.png

  • In shared-memory parallel computing, multiple processors (or "threads") perform tasks independently but share a common global memory. If a processor modified an array in the memory, all other processors can see this update as well
  • A serial code can be parallelized by marking code sections, which should be run in parallel, with openMP directives.
  • An openMP code can run on a single compute node and use up to maximum number of processors in that compute node, e.g., 24, 36, or 128 processors.
  • To run an openMP code, define number of processors(threads) in $OMP_NUM_THREADS
$ export OMP_NUM_THREADS=8
$ bsub -n 8 ./program


Distributed memory job (MPI)


Distributed memory computing.png

  • In distributed-memory parallel computing, multiple processors (or "cores") perform tasks independently while each processor possesses its own private memory resource. If a processor modify an array in its memory, this processor has to communicate to other processors so that the others see this update.
  • Massage Passing Interface (MPI) library implements distributed memory parallel computing which can be programmed in C, C++ and Fortran
  • An MPI program can run on a single compute node as well as on multiple compute nodes
  • An MPI program must be launched using "mpirun"
$ module load gcc/6.3.0 openmpi/4.0.2
$ bsub -n 240 mpirun ./program


Example

$ export OMP_NUM_THREADS=8
$ bsub -n 8 ./hello_omp
Generic job.
Job <8147290> is submitted to queue <normal.4h>.
$ unset OMP_NUM_THREADS
$ bsub -n 240 mpirun ./hello_mpi
MPI job.
Your environment is not configured for MPI.
Please load the module(s) needed by your job before executing 'bsub'.
Request aborted by esub. Job not submitted.
$ module load intel open_mpi
$ bsub -n 240 mpirun ./hello_mpi
MPI job.
Job <8147303> is submitted to queue <normal.4h>.


< Submit a job

Home

Monitor a job >