Pleasantly parallel and workload allocation

Overview

Definition
Example: integral estimation using the trapezoid method
Trapezoid example
Trapezoid example with process division
MPI implementation of trapezoid
1
2
3
4
5
mpicc -o trapezoid trapezoid.c
mpirun --host compute01:2,compute02:2 -np 4 ./trapezoid 0 1 10
mpirun --host compute01:2,compute02:2 -np 4 ./trapezoid 0 1 100
mpirun --host compute01:2,compute02:2 -np 4 ./trapezoid 0 1 1000
mpirun --host compute01:2,compute02:2 -np 4 ./trapezoid 0 1 10000

Accessing PSC

Set up jobs on Pittsburg Supercomputing Center
Creating MPI file
Create submission file

```bash linenums=”1” #!/bin/bash #SBATCH -N 1 #SBATCH -p RM #SBATCH -t 1:00:00 #SBATCH –ntasks-per-node=128

type ‘man sbatch’ for more information and options

this job will ask for 1 full RM node (128 cores) for 1 hours

this job would potentially charge 128 RM SUs

#echo commands to stdout set -x

move to working directory

this job assumes:

- all input data is stored in this directory

- all output should be stored in this directory

- please note that groupname should be replaced by your groupname

- PSC-username should be replaced by your PSC username

- path-to-directory should be replaced by the path to your directory where the executable is

echo ${PROJECT} cd ${PROJECT}/intro-mpi

module load openmpi/4.1.1-gcc8.3.1

mpicc -o trapezoid trapezoid.c mpirun -np 1 ./trapezoid 0 10 10000000000 mpirun -np 2 ./trapezoid 0 10 10000000000 mpirun -np 4 ./trapezoid 0 10 10000000000 mpirun -np 8 ./trapezoid 0 10 10000000000 mpirun -np 16 ./trapezoid 0 10 10000000000 mpirun -np 32 ./trapezoid 0 10 10000000000 ```

Submit and run
1
2
3
4
cd ${PROJECT}/intro-mpi
dos2unix trapezoid.sh
sbatch trapezoid.sh
squeue -u $USER

Workload assignment

Static workload assignment
Static workload assignment visualization via mandelbrot
Cyclic workload assignment
Cyclic workload assignment visualization via mandelbro
Dynamic workload assignment
Dynamic workload assignment visualization via mandelbro
1
2
- Modify your submission script to compile and run `trapezoid_dynamic.c`:
- What do you observe?