Newsgroups: comp.parallel.mpi
From: Lothar Thum <thum@mathpool.uni-augsburg.de>
Subject: pack problem
Organization: Universitaet Augsburg (Germany)
Date: Tue, 08 Oct 1996 13:20:16 +0200
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <325A38F0.41C6@mathpool.uni-augsburg.de>

Hi,

in my application I want to send several messages with maybe different
datatypes and numbers of elements. I want to use a buffer with a fixed
size to communicate with MPI_Pack() between two processes, say

% char buffer[BUFFSIZE];

The entire message - generated with successive calls of MPI_Pack() -
could be longer than BUFFSIZE. In that case I want to split the last
part message so that as many elements as possible could be packed into
buffer and then send the first part of the message and use 'buffer' a
second time for the rest of the message. For example I know from the
output argument 'position' of 

% int pos; 
% MPI_Pack(&partmessage, cnt, datatype, buffer, BUFFSIZE, &pos, comm);
              
that I have only BUFFSIZE-pos Bytes free in buffer.
MPI_Pack_size() provides an upper bound on the increment in position and
therefore I know if i can pack the part message completely into buffer.
But if not I want to know how many elements of 'datatype' I could pack
into buffer.

Is there a possibility in MPI to get this information ? I didn't find
it. Or is the answer that I have to use a dynamic buffer generated by
malloc() which i wanted to avoid because of performance considerations ? 

Lothar.

