Thread: Communication using MPI

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    PhysicistTurnedProgrammer Cell's Avatar
    Join Date
    Jan 2009
    Location
    New Jersey
    Posts
    72

    Communication using MPI

    Hey guys,

    I am trying to send a string from one processor to another using MPI.

    In one file, I have the send function specified by:

    Code:
    MPI_Send(str, 128, MPI_CHAR, 1, my_rank, MPI_COMM_WORLD);
    where my_rank is 0.

    And in another file, I have the receive function:

    Code:
    MPI_Recv(str, 128, MPI_CHAR, 0, my_rank, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
    where my_rank is 1.

    The files compile. But when I try to run the program I get the following error:

    Code:
    An error occurred in MPI_Send
    on communicator MPI_COMM_WORLD
    MPI_ERR_TAG: invalid tag
    MPI_ERRORS_ARE_FATAL (goodbye)
    From the MPI documentation:

    MPI_ERR_TAG
    Invalid tag argument. Tags must be non-negative; tags in a receive (MPI_Recv, MPI_Irecv, MPI_Sendrecv, etc.) may also be MPI_ANY_TAG. The largest tag value is available through the the attribute MPI_TAG_UB.
    I've also tried using MPI_ANY_TAG and I've received the same error.

    I should also mention that the way I run the program is by using:

    Code:
    mpirun -np 1 send : -np 1 receive
    Does anyone have any ideas?
    Last edited by Cell; 02-25-2009 at 10:23 AM. Reason: Added more info.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unkown Hang
    By Bladactania in forum C Programming
    Replies: 31
    Last Post: 04-22-2009, 09:33 AM
  2. Sorting whit MPI
    By isato in forum C Programming
    Replies: 0
    Last Post: 03-03-2009, 10:38 AM
  3. Malloc and MPI
    By moddinati in forum C Programming
    Replies: 17
    Last Post: 03-07-2008, 07:55 PM
  4. Looking for communication lib
    By BrownB in forum C Programming
    Replies: 3
    Last Post: 04-27-2005, 10:01 AM
  5. Serial communication packets
    By Roaring_Tiger in forum C Programming
    Replies: 3
    Last Post: 04-26-2003, 08:33 AM