Newsgroups: comp.parallel.mpi
From: Srinivasan Srivilliputhur <sgsrini@u.washington.edu>
Subject: On specifying message length as MPI_Irecv() argument
Organization: University of Washington
Date: Sat, 5 Jul 1997 09:49:47 -0700
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Message-ID: <Pine.A41.3.95b.970705092016.6688A-100000@dante22.u.washington.edu>

Hi-
I've run into a sticky spot in my parallel code.  Let me explain my
problem.

Basic Background:
----------------
** Upper Limit to the Number of processors used	= 1024
** Each processor in my simulation sends and receives a message from 26
   other processors I call "Neighbors" (the Rank of these nodes are
   known). 
** Message lengths can vary between 8-bytes and 2MB (I assume that these
   are the extreme values; but CAN INCREASE THE UPPER LIMIT IF NECESSARY). 
** Message lengths can vary from one call to the next and from one
   neighboring processor to the next.
** I run this code on IBM SP2, but that should NOT matter.


My Pseudo-Code:
--------------
  /* Post non-blocking receive and return before completion */
  MPI_Irecv( (void *) RecvBuffer, MaxMsgLen, MPI_CHAR, MPI_ANY_SOURCE, 
             msgtype, MPI_COMM_WORLD, &IrecvRequest );

  /* Send the message using blocking send */
  MPI_Isend( (void *) SendBuffer, MaxMsgLen, MPI_CHAR, 
	     destnode, msgtype, MPI_COMM_WORLD, &IsendRequest);

  /* wait for MPI_Irecv() to complete */
  MPI_Wait( &IrecvRequest, &IrecvStatus );

My Problem:
----------
As you see, we have to specify the message length when we post MPI_Irecv()
Since I do not know this apriori, I am forced to use "MaxMsgLen" (the size
of the "SendBuffer[]".  This means that for a 8byte message I am forced to
send about 2MB.  

(Q.1) Is there a tag that allows blind-card value for message length, that
      can be used in MPI_Irecv()  ?? 
(Q.2) If not how can I solve this "Message Length" dilemma ??

I know that I can have a separate communication step where by each
processor sends the length of the message that will follow shortly.  But
that means for each step I send 26 extra messages (and I want to avoid
it).

I appreciate all your help.

Thanks and with best regards

-Srini



-------------------------------------------------------------------------------
S. G. Srinivasan                email : sgsrini@u.washington.edu
Graduate Student
Dept. Of Mater. Sci. & Engg.
Room 204, Roberts Hall, BOX 352120
University Of Washington        
Seattle, WA 98195-2120                  (206)-685-3851 (W)
				FAX   : (206)-543-3100 (W)
-------------------------------------------------------------------------------
              REALITY IS AN APPROXIMATION OF THEORY - anonymous
-------------------------------------------------------------------------------


