Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > MPI and Pthread

Reply
Thread Tools

MPI and Pthread

 
 
Pallav singh
Guest
Posts: n/a
 
      09-13-2010
Hi ,

i am trying to compile following program and getting error due to
unable to include
path to File "mpi.h" . Is it provided under Linux kernel or we need to
download library for this

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

/* A simple test of Reduce with all choices of root process */
int main( int argc, char *argv[] )
{
int errs = 0;
int rank, size, root;
int *sendbuf, *recvbuf, i;
int minsize = 2, count;
MPI_Comm comm;

MPI_Init( &argc, &argv );

comm = MPI_COMM_WORLD;
/* Determine the sender and receiver */
MPI_Comm_rank( comm, &rank );
MPI_Comm_size( comm, &size );

for (count = 1; count < 130000; count = count * 2) {
sendbuf = (int *)malloc( count * sizeof(int) );
recvbuf = (int *)malloc( count * sizeof(int) );
for (root = 0; root < size; root ++) {
for (i=0; i<count; i++) sendbuf[i] = i;
for (i=0; i<count; i++) recvbuf[i] = -1;
MPI_Reduce( sendbuf, recvbuf, count, MPI_INT, MPI_SUM,
root, comm );
if (rank == root) {
for (i=0; i<count; i++) {
if (recvbuf[i] != i * size) {
errs++;
}
}
}
}
free( sendbuf );
free( recvbuf );
}

MPI_Finalize();
return errs;
}

Thanks
Pallav Singh
 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      09-13-2010
On 9/13/2010 7:28 AM, Pallav singh wrote:
> i am trying to compile following program and getting error due to
> unable to include
> path to File "mpi.h" . Is it provided under Linux kernel or we need to
> download library for this
>
> #include "mpi.h"
> [..C program snipped..]


Your C program does not seem to contain any error. It's the setup your
compiler has (the directories, the command line, etc.) that apparently
interferes with your ability to compile your program. We can't help you
with that. You need to ask in the newsgroup that deals with your
compiler, or with the newsgroup that deals with the library you're
trying to use. There folks can tell you what options/settings would
need to be set/used. If you think that your OS might be providing those
headers/libraries, post your inquiry in the newsgroup that deals with
your OS (possibly in the 'comp.os.linux.development.*' hierarchy).

This newsgroup is for discussions on C++ *language* issues. You don't
have any, at least so it seems.

Good luck!

V
--
I do not respond to top-posted replies, please don't ask
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MPI and Pthread Pallav singh C Programming 14 09-15-2010 03:27 PM
GNU GMP and MPI hector C Programming 4 03-20-2008 04:36 PM
parallel programming using MPI and C++ aaragon C++ 1 08-29-2007 01:56 AM
MPI and python+threads on IRIX Marc Poinot Python 0 01-21-2005 04:09 PM
pyMPI and calling MPI functions using Boost.Python Natsu Mizutani Python 0 02-20-2004 10:17 PM



Advertisments