MPI Progr(mming L(b
About job submission
Jobscript [Link]: [Link]
Use your [Link] .s jobn-me
Set -n in -prun [Link] .s .[Link]
All output to stdout .nd stderr from .prun will be in [Link]
Submit job (specify queue [Link] for tod.y):
$ qsub -q QUEUENAME [Link]
MPI Exercises
MPI function synt.x .[Link] on [Link] - [Link] MPI_function_n.me on the
web
01-1-hello-world.c
Insert . print [Link] (ex. hello world) .nd [Link] it . Hello World C/Fortr.n
progr.m
Compile
$ cc 01-1-hello-world.c
Submit . job using [Link], with ONE process
$ qsub [Link]
Check output in [Link]
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 .[Link] [Link]
MPI_Init(&argc, &argv);
MPI_Finalize();
Compile
Submit . job using [Link], with n processes (n <=24. Your choice)
Check output in [Link]
02-hello-world-myr(nk-size.c
Develop your Hello World MPI progr.m to print MPI [Link] .nd MPI size [Link]
Compile
Submit . job using [Link], with n processes (n <=24. Your choice)
Check output in [Link]
Bro(dc(st
Develop your hello world progr.m to set
sendv.l = 10 only on [Link] 0
[Link] sendv.l to .ll [Link]
Print sendv.l from .ll [Link], .long with [Link].
Run the code with n = 4 processes.
03-prime-seri(l.c
This code checks if . given number is prime number.
[Link] the seri.l code.
[Link] with MPI.
[Link] .n [Link] output from [Link] code. (Hint: Use some
[Link]).
How is the lo.d [Link] for .n .[Link] test number? Discuss [Link] to improve.
MPI_Reduce
Write . progr.m to [Link] . [Link] v-r to different integers in different
[Link].
[Link] the sum of .ll such [Link] in R-nk 0 using MPI_Reduce .nd print.
Run the code for n < 24 .nd verify the output.
Obt(in size of MPI_COMM_WORLD.
Use your [Link]-size progr.m to [Link] the size of
MPI_COMM_WORLD, without using the MPI function MPI_Comm_size
Run the code for n < 24 .nd verify the output.
mpi_hello world two r(nks
Write .n MPI Hello world progr.m for two [Link].
Print different strings from different [Link].
For [Link],
“Hello world from [Link] 0” from [Link] 0
“A [Link] Hello from [Link] 1” from [Link] 1
Run the code for n =2 .nd verify the output.
MPI_Send (nd MPI_recv
Use the code from .bove exercise .nd set sendv-l = 10, recvv-l = 30
Send the [Link] sendv-l from [Link] 1 .nd receive it in [Link] 0 to recvv-l
Print recvv-l before .nd .fter the MPI function [Link].
Run the code for n = 2 .nd n > 2.
Discuss the output
MPI_Sendrecv - circul(r
Write . progr.m to implement MPI_Sendrecv
..
set sendv.l = 1, recvv.l = 10.
From [Link] 0, send sendv.l to [Link] 1 [Link] recvv.l
From [Link] 1, send sendv.l to [Link] 2 [Link] recvv.l .nd so on.
[Link] 9 should send to [Link] 0.
b.
Modify the progr.m so th.t [Link] 1 sends “the v-lue it received” to [Link] 2 .nd
so on
Is it possible to .chieve it using Sendrecv?
C(lcul(te the v(lue of Pi
pi_mpi.c is . seri.l code to [Link] the [Link] of pi.
[Link] the code with MPI. Look for comments .nd commented lines .nd
[Link] .s .[Link].
[Link] the [Link] result with seri.l result.
AlltoAll
[Link] of MPI_AlltoAll .nd AlltoAllv .re provided in /mnt/lustre/serc3/
secguest*/2020J(n-MPI/D(y-2