PRECV(3PVM)
π PRECV β the pvm_precv page, but make it make sense
okay bestie, sit down, hydrate, because we're learning pvm_precv from the PVM Version 3.4 manual and honestly? it's giving "receive a message directly into a buffer." no cap. that's the whole NAME. π«Ά
β¨ NAME β¨
pvm_precv β receive a message directly into a buffer. that's it, that's the girl. π
πΈ SYNOPSIS πΈ
C bestie:
int info = pvm_precv( int tid, int msgtag, char *buf,
int len, int datatype, int *atid,
int *atag, int *alen )
Fortran bestie:
call pvmfprecv( tid, msgtag, buf, len, datatype,
atid, atag, alen, info )
π PARAMETERS π
the whole cast, no skips:
tidβ Integer task identifier of the sending process (the one you're matching against, iykyk).msgtagβ Integer message tag to match. and listen,msgtagshould be >= 0. respect the bit. π€bufβ Pointer to a buffer to receive into. the landing zone.lenβ Length of buffer (in multiple of data type size). math girlies rise.datatypeβ Type of data thatbufpoints to (full list further down, don't scroll past it π«£).atidβ Returns actual TID of sender. the receipts. π§Ύatagβ Returns actual message tag.alenβ Returns actual message length.infoβ ReturnsPvmOkon success. Values less than zero indicate an error. π
π DESCRIPTION π
so pvm_precv blocks the process until a message with label msgtag has arrived from tid. like, it will simply wait. main character patience. then it places the contents of the message in the supplied buffer, buf, up to a maximum length of len * (size of data type).
and it's flexible, okay? pvm_precv can receive messages sent by pvm_psend, pvm_send, pvm_mcast, or pvm_bcast. four whole senders. she's not picky. π
π¦ the wildcard lore (this part matters)
a -1 in msgtag or tid matches anything. this gives you the following options, and yes we're listing all of them:
- if
tid = -1andmsgtagis defined by the user, thenpvm_precvwill accept a message from any process which has a matchingmsgtag. - if
msgtag = -1andtidis defined by the user, thenpvm_precvwill accept any message that is sent from processtid. - if
tid = -1andmsgtag = -1, thenpvm_precvwill accept any message from any process. absolute chaos mode, we love her. π
π the datatype menu (C edition)
in C the datatype parameter must be one of the following, depending on the type of data to be unpacked:
[Version 3.3.0 β This parameter only determines message length, not data conversion. It only unpacks raw bytes]
PVM_STRβ stringPVM_BYTEβ bytePVM_SHORTβ shortPVM_INTβ intPVM_FLOATβ realPVM_CPLXβ complexPVM_DOUBLEβ doublePVM_DCPLXβ double complexPVM_LONGβ long integerPVM_USHORTβ unsigned short intPVM_UINTβ unsigned intPVM_ULONGβ unsigned long int
in Fortran, use the same data types specified for unpack. matching set, bestie. β¨
π message order tea (PVM guarantees this, fr fr)
the PVM model guarantees the following about message order. if task 1 sends message A to task 2, then task 1 sends message B to task 2, message A will arrive at task 2 before message B. and moreover, if both messages arrive before task 2 does a receive, then a wildcard receive will always return message A. queue behavior? iconic. π
π success + blocking behavior
if pvm_precv is successful, info will be = 0. if some error occurs then info will be < 0.
pvm_precv is blocking, which means the routine waits until a message matching the user specified tid and msgtag arrives at the local pvmd. but if the message has already arrived then pvm_precv returns immediately with the message. no waiting around for no reason, she's efficient. β
also, pvm_precv does not affect the state of the current receive message buffer (the one created by the other receive functions). hands off, respectfully. π
β οΈ WARNINGS β οΈ
ok this is the scary part, read it, i'm serious, this is not a vibe, this is a whole hazard. π¨
in some versions of PVM (CM5, I860 and PGON), messages sent using pvm_psend must be received only by pvm_precv, likewise those sent with pvm_send must be received by pvm_recv, pvm_nrecv or pvm_trecv. pvm_psend is not compatible with pvm_recv (nor pvm_send with pvm_precv). in addition, pvm_probe is not interoperable with pvm_psend.
this problem occurs because nonstandard message headers are used for efficiency in the pvm_psend function. in the generic Unix version of PVM, the calls are fully interoperable. so it depends on the platform, bestie. check before you commit. π
and one more: the message tag space is shared between pvm_send and pvm_psend, so you must be careful to avoid selecting the wrong message (for example by using a wildcard to match the message). wildcard = risky behavior. lowkey thrilling, highkey dangerous. π
π§ EXAMPLES π§
C:
info = pvm_precv( tid, msgtag, array, cnt, PVM_FLOAT,
&src, &rtag, &rlen );
Fortran:
CALL PVMFPRECV( -1, 4, BUF, CNT, REAL4,
> SRC, RTAG, RCNT, INFO )
look at her go. ate. π₯
π ERRORS π
these error conditions can be returned by pvm_precv:
PvmBadParamβ giving an invalidtid,msgtag, ordatatype. (basically: you handed her something wrong.)PvmSysErrβpvmdnot responding. (the daemon ghosted you, rip. π»)
π SEE ALSO π
go read these next, bestie, they're in the group chat too:
pvm_psend(3PVM)pvm_recv(3PVM)
and that's the page!! 15 March, 1994 is the date on this one and it's from the PVM Version 3.4 manual, which, yes, is older than all of us, but she still slays. mwah. πππ¦β¨
PRECV(3PVM) β periodt. πΈ
π¦ where this page comes from
- debian bookworm: pvm-dev 3.4.6-5
- ubuntu jammy: pvm-dev 3.4.6-3.2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms