PROBE(3PVM)

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

πŸ’– PROBE(3PVM) β€” pvm_probe πŸ’–

okay bestie, sit down, hydrate, and let me tell you about pvm_probe from PVM Version 3.4. this one's a little detective. she doesn't grab your mail, she just peeks at the mailbox and goes "yeah something's in there" πŸ•΅οΈβ™€οΈβœ¨


✨ NAME ✨

pvm_probe β€” check if message has arrived. that's it. that's the whole job. she's nosy, not pushy. πŸ’…


🌸 SYNOPSIS 🌸

C:

int bufid = pvm_probe( int tid, int msgtag )

Fortran:

call pvmfprobe( tid, msgtag, bufid )

πŸŽ€ PARAMETERS πŸŽ€

  • tid β€” integer task identifier of the sending process, supplied by you, the user. πŸ‘ˆ
  • msgtag β€” integer message tag, also supplied by you. and bestie, msgtag should be >= 0. no cap.
  • bufid β€” integer that returns the value of the new active receive buffer identifier. if it comes back less than zero? that's an error, babes. values less than zero indicate an error. 😭

πŸ¦‹ DESCRIPTION πŸ¦‹

so pvm_probe checks whether a message with label msgtag has arrived from tid. that's the vibe check. if a matching message has arrived, pvm_probe hands you back a buffer identifier in bufid. and that bufid is lowkey a key πŸ”‘ β€” you can use it with pvm_bufinfo to find out info about the message, like its source and its length.

if the message you asked about hasn't arrived yet? pvm_probe comes back with a 0 in bufid. not an error, just a "nope, not yet, keep scrolling." and if some error happens, bufid will be < 0. πŸ’€

now here's the part that's giving flexibility. a -1 in msgtag or tid matches anything. so you get these options:

  • if tid = -1 and msgtag is defined by you, then pvm_probe will accept a message from any process that has a matching msgtag.
  • if msgtag = -1 and tid is defined by you, then pvm_probe will accept any message that is sent from process tid.
  • if tid = -1 and msgtag = -1, then pvm_probe will accept any message from any process. wildcard mode activated, main character energy. 🌈

also, you can call pvm_probe multiple times to check if a given message has arrived yet. keep peeking, it's fine. BUT β€” and this is the important part β€” after the message has arrived, pvm_recv must be called before the message can be unpacked into your memory using the unpack routines. probe is the peek, pvm_recv is the actual grab. don't skip the grab. 🫢


πŸ’« EXAMPLES πŸ’«

C:

tid = pvm_parent();
msgtag = 4 ;
arrived = pvm_probe( tid, msgtag );
if ( arrived )
     info = pvm_bufinfo( arrived, &len, &tag, &tid );
else
     /* go do other computing */

Fortran:

CALL PVMFPROBE( -1, 4, ARRIVED )
IF ( ARRIVED .GT. 0 ) THEN
     CALL PVMFBUFINFO( ARRIVED, LEN, TAG, TID, INFO )
ELSE
*         GO DO USEFUL WORK
ENDIF

see how the else branch is literally just "go do other computing"? that's the whole point. probe is non-blocking, she does not wait around. she has places to be. πŸ’…βœ¨


πŸ”₯ ERRORS πŸ”₯

these error conditions can be returned by pvm_probe. bestie, write these down:

  • PvmBadParam β€” you gave an invalid tid value or msgtag. oops. πŸ™ˆ
  • PvmSysErr β€” pvmd not responding. the daemon ghosted you. πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

pvm_bufinfo(3PVM), pvm_getminfo(3PVM), pvm_nrecv(3PVM), pvm_recv(3PVM), pvm_unpack(3PVM)

go read those next, bestie, they're all part of the same lil message-handling friend group. 🧚


and that's the page!! this one's from PVM Version 3.4, dated 30 August, 1993 β€” yeah she's an old queen but she still slays πŸ’–πŸ‘‘ if you made it to the bottom of this manpage, congrats, you're literally the moment. mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from