Error while runing MPI program

12 messages Options
Embed this post
Permalink
Rahul8590

Error while runing MPI program

Reply Threaded More More options
Print post
Permalink
Firstly thanks to you guys.. for helping me so far
i type the following mpi c program

#include<stdio.h>
#include<mpi.h>

int main (int argc , char _argv[])
{
        int rank=0, size=0;
        MPI Init(&argc , &argv);
        MPI Comm rank(MPI COMM WORLD , &rank);
        MPI Comm size(MPI COMM WORLD , &size);
printf("hello world ! i am %d of %d",rank, size);
MPI Finalize();
return 0;
}


and i got this error in terminal

Output:

hello.c: In function ‘main’:
hello.c:7: error: ‘MPI’ undeclared (first use in this function)
hello.c:7: error: (Each undeclared identifier is reported only once
hello.c:7: error: for each function it appears in.)
hello.c:7: error: expected ‘;’ before ‘Init’
hello.c:8: error: expected ‘;’ before ‘Comm’
hello.c:9: error: expected ‘;’ before ‘Comm’
hello.c:11: error: expected ‘;’ before ‘Finalize’
mpicc: No such file or directory


i don`t understand wat exactly is the problem.

 
Michael Creel

Re: Error while runing MPI program

Reply Threaded More More options
Print post
Permalink
You are missing some underscores: it's "MPI_Init", not "MPI Init", same for the other MPI functions. See http://www.dartmouth.edu/~rc/classes/intro_mpi/hello_world_ex.html for an example.
Rahul8590

Re: Error while runing MPI program

Reply Threaded More More options
Print post
Permalink
Well i did as u said and the program ran straight away.. No problems.

The output i from the print statement  is :
Hello world ! i am 0 of 1

Print statement :
printf("hello world ! i am %d of %d",rank, size);

Well i am not actually getting why is the size outputted as "1" even thought my cluster had
2 - client nodes
1 -  server node


and when i ran the same program in the client nodes , i still got the same output.
IS there any way to communicate between the nodes just to verify that all are working fine.
Michael Creel

Re: Error while runing MPI program

Reply Threaded More More options
Print post
Permalink
I guess you ran it with the command "mpirun -np 2 hello" or something similar. To get it to run on 3 ranks use "mpirun -np 3 hello". There is a fair amount to learn hear about how MPI ranks are assigned to different physical computers. To get a better idea of how that works you should probably run through one of the MPI tutorials that are available on the web. Some bookmarks are available on the last version of ParallelKnoppix, I don't have that information handy now.
Rahul8590

Re: Error while runing MPI program

Reply Threaded More More options
Print post
Permalink
but even in a 3 cluster environment if  i run the command

mpirun -np13 hello

its still running and giving me the output.
But at the same time if i write

mpirun n0-2 hello  (here i am specifying n0 , n1, n2 nodes ) its giving me error saying that node n0 not found or so.

the same even if write mpirun n0-1 hello

Well is there any way that i can test the working of nodes (apart from the fact the nodes are booting from the network , which itself gives the proof that the cluster architecture is formed )
 
Michael Creel

Re: Error while runing MPI program

Reply Threaded More More options
Print post
Permalink
This thread gives some ideas about how to see activity:
http://www.nabble.com/%C2%BFis-tping-enough-to-assume-a-cluster-is-working--td24815618.html

If you run some of the cpu intensive examples for octave you will see more cpu activity on the compute nodes.
Rahul8590

Re: Error while runing MPI program

Reply Threaded More More options
Print post
Permalink
Michael Creel wrote:
If you run some of the cpu intensive examples for octave you will see more cpu activity on the compute nodes.
Well wat exactly u mean by that ?
Besides are there any standard programs or packages which can do that.
Since i can use hardisk space of all nodes , i am planning for a permanent installation.
Michael Creel

Re: Error while runing MPI program

Reply Threaded More More options
Print post
Permalink
I mean that by using a cluster monitor you will be able to see the processes that are running any/all of the nodes in the cluster. That way you will know that it is working. For a standard program, the HPL benchmark is pretty widely used, and is included on PelicanHPC. For a permanent installation, PelicanHPC is probably not the tool of choice - Rocks is a well known distro designed for permanent cluster installations.
Rahul8590

Re: Error while runing MPI program

Reply Threaded More More options
Print post
Permalink
How do i use the benchmark programs in pelican HPC ? . I guess that would provide cogent evidence of the cluster network being setup.

Michael Creel

Re: Error while runing MPI program

Reply Threaded More More options
Print post
Permalink
There is a README file in the HPL directory that explains how.
Rahul8590

Re: Error while runing MPI program

Reply Threaded More More options
Print post
Permalink
i tried searching the HPL directory .. couldnt find that.

Can u give me the path of  that.
Michael Creel

Re: Error while runing MPI program

Reply Threaded More More options
Print post
Permalink
I think that it's /home/user/hpl. Just search around in /home/user and you'll find it.