MPI-Programming-Lab
MPI-Programming-Lab
MPI Exercises
01-1-hello-world.c
Insert . print st.tement (ex. hello world) .nd m.ke it . Hello World C/Fortr.n
progr.m
Compile
$ cc 01-1-hello-world.c
Submit . job using jobscript.sh, with ONE process
$ qsub jobscript.sh
Check output in screen.out
01-2-hello-world.c
Turn your Hello World progr.m, or this one, into .n MPI Hello World progr.m
Look for comments .nd insert .ppropri.te st.tements
MPI_Init(&argc, &argv);
MPI_Finalize();
Compile
Submit . job using jobscript.sh, with n processes (n <=24. Your choice)
Check output in screen.out
02-hello-world-myr(nk-size.c
Develop your Hello World MPI progr.m to print MPI R.nk .nd MPI size v.lues
Compile
Submit . job using jobscript.sh, with n processes (n <=24. Your choice)
Check output in screen.out
Bro(dc(st
Develop your hello world progr.m to set
sendv.l = 10 only on R.nk 0
Bro.dc.st sendv.l to .ll r.nks
Print sendv.l from .ll r.nks, .long with myr.nk.
03-prime-seri(l.c
This code checks if . given number is prime number.
Underst.nd the seri.l code.
P.r.llelize with MPI.
Obt.in .n un.mbiguous output from p.r.llel code. (Hint: Use some
communic.tion).
How is the lo.d b.l.nce for .n .rbitr.ry test number? Discuss w.ys to improve.
MPI_Reduce
Write . progr.m to initi.lize . v.ri.ble v-r to different integers in different
r.nks.
Obt.in the sum of .ll such v.lues in R-nk 0 using MPI_Reduce .nd print.
Run the code for n < 24 .nd verify the output.
b.
Modify the progr.m so th.t R.nk 1 sends “the v-lue it received” to R.nk 2 .nd
so on
Is it possible to .chieve it using Sendrecv?
AlltoAll
Ex.mples of MPI_AlltoAll .nd AlltoAllv .re provided in /mnt/lustre/serc3/
secguest*/2020J(n-MPI/D(y-2