I see, learn and rediscover… everyday!
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 :) .
| Print article | This entry was posted by sp2hari on May 18, 2007 at 12:38 pm. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 3 years ago
now who is the pshyco !!!
lol
about 3 years ago
now who is the psyhco!!!
about 3 years ago
Of course you are :) . I have no doubt abt that :P