Newsgroups: comp.parallel.pvm
From: manchek@thud.cs.utk.edu (Bob Manchek)
Subject: Re: URGENT: PVM's buffer size problem
Organization: Computer Science Dept, University of Tennessee, Knoxville
Date: 4 Oct 1995 15:13:56 GMT
Message-ID: <44u8bkINN3p7@CS.UTK.EDU>

In article <44to29$njf@cosmos.imag.fr>, teodores@imag.fr (Florin Teodorescu) writes:
|> Just look that piece of code:
|> 
|> char one_byte;
|> char *string;
|> ...
|> 
|> bufid = pvm_initsend(PvmDataDefault);
|>                               ---------> point A
|> pvm_pkbyte(&one_byte,1,1);
|>                               ---------> point B
|> pvm_pkstr(string); /* strlen(string) == 7 */
|>                               ---------> point C
|> 
|> 
|> Using the pvm_bufinfo() call, I've got the folowing buffer sizes, for each
|> of the points above:
|> 
|> Point A: 0	-- ok, as expected.
|> Point B: 4	-- 3 bytes more as expected.
|> Point C: 16	-- 16 - 4 = 12 => 4 bytes more than expected.
|> 
|> Can anyone explain me how does the pvm's packing mechanism works?
|> Or better: How can I get *precisely* the size of a PVM's buffer?
|> 
|> 
|> Thanks a lot
|> 
|> Florin				Florin.Teodorescu@imag.fr

pvm_bufinfo reports the exact number of bytes in the message buffer,
which I admit may not make much sense for encodings other than Raw.
Using PvmDataRaw, data is packed into the buffer with no padding or
conversion.

When you use PvmDataDefault, the data passes through XDR during pack
and unpack.  This means that each data type has a specific size,
independent of the machine's native sizes (shorts are 2, ints are 4,
etc.).  Plus, after each pack call the length is rounded up to be a
multiple of 4 bytes.

Also, strings are packed as an integer length, then the null-terminated
byte string.

To look at a message buffer in detail, use umbuf_dump.  Calling
umbuf_dump(pvm_getsbuf(), 2) will dump the contents of the current
send buffer (the one being packed).

-b

-- 
/ Robert Manchek                University of Tennessee     /
/                               Computer Science Department /
/ (423)974-8295                 Ayres Hall #104             /
/ manchek@CS.UTK.EDU.           Knoxville TN  37996-1301    /
/     http://www.netlib.org/utk/people/BobManchek.html      /


