INITSEND(3PVM)

πŸ“¦ version 3.4.6, in debian bookworm, ubuntu jammy

πŸ’Œ INITSEND(3PVM) β€” the pvm_initsend glow-up

okay bestie, welcome to INITSEND(3PVM) from the PVM Version 3.4 manual β€” this is the page that tells you how to wipe your send buffer clean and pick how your message is gonna get encoded. it's giving fresh-start energy. let's go πŸ’…


✨ NAME ✨

pvm_initsend β€” clears the default send buffer and tells PVM how to encode your message.

like, it's the reset button before you pack a whole new vibe into a message πŸŽ€


🌸 SYNOPSIS 🌸

C:

int bufid = pvm_initsend( int encoding )

Fortran:

call pvmfinitsend( encoding, bufid )

πŸ¦‹ PARAMETERS πŸ¦‹

  • encoding β€” an integer that says which encoding scheme the next message is gonna use. In C your options are:
    • PvmDataDefault β€” 0 β€” XDR
    • PvmDataRaw β€” 1 β€” no encoding
    • PvmDataInPlace β€” 2 β€” data left in place

and in Fortran the option names go by:

  • PVMDEFAULT β€” 0 β€” XDR
  • PVMRAW β€” 1 β€” no encoding
  • PVMINPLACE β€” 2 β€” data left in place
  • bufid β€” the integer that comes back holding your message buffer identifier. if it's less than zero, bestie, that means an error happened 😭

πŸ’– DESCRIPTION πŸ’–

so pvm_initsend literally clears the send buffer and gets it ready for packing up a brand new message. the encoding scheme you're gonna pack with? that's set by encoding. 🫢

XDR encoding is the default, and here's why: PVM has no idea whether you're about to add a heterogeneous machine into the mix before this message actually gets sent. it can't read your mind, queen. but if you know the next message is only ever going to a machine that understands the native format, you can use PvmDataRaw encoding and save on those encoding costs. ate. ✨

PvmDataInPlace encoding says: leave the data in place while packing. the message buffer only holds the sizes and pointers to the items being sent. then when pvm_send gets called, the items are copied directly out of your memory. this option cuts down the number of times a message gets copied, but the trade-off is real β€” you're not allowed to modify the items between the moment they're packed and the moment they're sent. so like, hands off, okay? πŸ™ˆ

if pvm_initsend succeeds, bufid will contain the message buffer identifier. if some error occurs, then bufid will be < 0. no cap.


🚫 RESTRICTIONS 🚫

listen up, because this one matters: PvmDataInPlace allows only dense (stride = 1) data in version 3.3. it cannot be used on shared memory (*MP) architectures β€” a PvmNotImpl error will occur at send time. so if you're on *MP, that's a hard no, babes. πŸ’€

🌈 EXAMPLES 🌈

C:

bufid = pvm_initsend( PvmDataDefault );
info = pvm_pkint( array, 10, 1 );
msgtag = 3 ;
info = pvm_send( tid, msgtag );

Fortran:

CALL PVMFINITSEND(PVMRAW, BUFID)
CALL PVMFPACK( REAL4, DATA, 100, 1, INFO )
CALL PVMFSEND( TID, 3, INFO )

look at that. iconic. πŸ‘‘


😭 ERRORS 😭

these error conditions can be returned by pvm_initsend:

  • PvmBadParam β€” you gave an invalid encoding value. wrong vibe, try again πŸ™ˆ
  • PvmNoMem β€” Malloc has failed. there is not enough memory to create the buffer. tragic. truly.

πŸ‘€ SEE ALSO πŸ‘€

  • pvm_mkbuf(3PVM)

and that's the whole page, bestie!! this was INITSEND(3PVM) from PVM Version 3.4, dated 30 August, 1993 β€” yes she's an elder but she still slays πŸ’œ go clear that buffer and pack something beautiful. mwah! πŸ’–βœ¨

πŸ“¦ where this page comes from