Running MPI on DICE

Hello World

We are going to use C to write the hello world programNow we can compile with mpicc

mpicc -o hello hello.c

Now we are ready to run in 4 processors:

mpirun -np 4 hello

Printing ranks and the number of processors

Lets define two functions MPI_COMM_WORLD to read the rank and the total sizeNow we print the output 3. Now we are going to print the hello world just from the master

If you run with one or four processor, it will only print rank ‘0’ as follow:What if the last MPI function is deleted?

The routine MPI_FINALIZE must be called by each process before it exits. The call cleans up all MPI state. Once MPI_FINALIZE has been called, no routine might be called except for MPI_GET_VERSION, MPI_INITIALIZED and MPI_FINALIZED. MPI_FINALIZE guarantees nothing about pending communications that have not been completed.

Advertisements

About Julita Inca

Ingeniero de Sistemas UNAC, Magíster en Ciencias de la Computación PUCP, OPW GNOME 2011, Miembro de la GNOME Foundation desde el 2012, Embajadora Fedora Perú desde el 2012, ganadora del scholarship of the Linux Foundation 2012, experiencia como Admin Linux en GMD y Especialista IT en IBM, con certificaciones RHCE, RHCSA, AIX 6.1, AIX 7 Administrator e ITILv3. Experiencia académica en universidades como PUCP, USIL y UNI. HPC researcher, Leader of LinuXatUNI Community, a simple mortal like you!
This entry was posted in Education, τεχνολογια :: Technology and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s