Hello World …

I love Hello World programs.
The reason is simple. Whenever i code a hello world, it means i am learning something new. I once found a huge collection of hello world programs here.

And yes, i did a hello world program today. It is related cluster programming using MPI . :-) .

The code for the hello world

#include <stdio.h>
#include <mpi/mpi.h>
int main(int argc, char *argv[]) {
int err;
err = MPI_Init(&argc, &argv);
printf (“Hello World\n”);
err = MPI_Finalize();
}

Since i dont have a cluster at home, i had to simulate a cluster. That can be done using the mpirun command .

hari@home:~/spider/cluster$ mpirun -np 3 a.out
Hello World
Hello World
Hello World
hari@home:~/spider/cluster$

For the first time, this asked for my password 3 times ( the number of process i mentioned ) . After that i created a keygen for myself and then things went fine . But it took a long time when i gave the number of processes as 100 .

Planning to code for a fractal using MPI in my free time :) .

3 thoughts on “Hello World …

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>