MPI and Pthread

Discussion in 'C++' started by Pallav singh, Sep 13, 2010.

  1. Pallav singh

    Pallav singh Guest

    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;
    for (i=0; i<count; i++) recvbuf = -1;
    MPI_Reduce( sendbuf, recvbuf, count, MPI_INT, MPI_SUM,
    root, comm );
    if (rank == root) {
    for (i=0; i<count; i++) {
    if (recvbuf != i * size) {
    errs++;
    }
    }
    }
    }
    free( sendbuf );
    free( recvbuf );
    }

    MPI_Finalize();
    return errs;
    }

    Thanks
    Pallav Singh
     
    Pallav singh, Sep 13, 2010
    #1
    1. Advertising

  2. 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
     
    Victor Bazarov, Sep 13, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Natsu Mizutani
    Replies:
    0
    Views:
    581
    Natsu Mizutani
    Feb 20, 2004
  2. Marc Poinot

    MPI and python+threads on IRIX

    Marc Poinot, Jan 21, 2005, in forum: Python
    Replies:
    0
    Views:
    303
    Marc Poinot
    Jan 21, 2005
  3. aaragon
    Replies:
    1
    Views:
    490
    Victor Bazarov
    Aug 29, 2007
  4. hector

    GNU GMP and MPI

    hector, Mar 20, 2008, in forum: C Programming
    Replies:
    4
    Views:
    524
    Keith Thompson
    Mar 20, 2008
  5. Pallav singh

    MPI and Pthread

    Pallav singh, Sep 13, 2010, in forum: C Programming
    Replies:
    14
    Views:
    1,610
    Malcolm McLean
    Sep 15, 2010
Loading...

Share This Page