Friday, May 18, 2007

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

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 :) .


-->suren<-- said...

now who is the pshyco !!!

-->suren<-- said...

now who is the psyhco!!!

Harishankaran said...

Of course you are :) . I have no doubt abt that :P