PSEND(3PVM)

๐Ÿ“ฆ version 3.4.6, in debian bookworm, ubuntu jammy

๐Ÿ’– PSEND(3PVM) ๐Ÿ’–

okay bestie, so this is a page from the PVM Version 3.4 manual, and it's literally all about pvm_psend โ€” the routine that packs and sends your data in one single call. one call!! no separate pack step, we love a time-saver. โœจ


๐ŸŒธ NAME ๐ŸŒธ

pvm_psend โ€” pack and send data in one call. that's it, that's the whole vibe. ๐Ÿซถ


โœจ SYNOPSIS โœจ

C girlies:

int info = pvm_psend( int tid, int msgtag, char *buf,
                       int len, int datatype )

Fortran girlies:

call pvmfpsend( tid, msgtag, buf, len, datatype,
                info )

๐ŸŽ€ PARAMETERS ๐ŸŽ€

  • tid โ€” the integer task identifier of the destination process. that's where your data is going, your little pen pal. ๐Ÿ’Œ
  • msgtag โ€” an integer message tag that you supply. heads up: msgtag should be >= 0.
  • buf โ€” pointer to a buffer to send. yes, the actual data, the whole point.
  • len โ€” length of the buffer, and it's measured in multiples of the data type size. don't forget that part, it's giving sneaky. ๐Ÿ‘€
  • datatype โ€” the type of data that buf points at (full list down below, keep scrolling).
  • info โ€” integer status code that the routine hands back to you. this is how you find out if it went well.

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So pvm_psend takes a pointer to a buffer buf, its length len, and its data type datatype, and sends that data directly to the PVM task identified by tid. msgtag is the label you slap on the content of the message so everyone knows what's inside. no cap. ๐Ÿท๏ธ

If pvm_psend succeeds, info will be 0. If something goes wrong, info will be < 0 and you'll be like ๐Ÿ˜ญ.

the data you send with pvm_psend can be received by pvm_precv, pvm_recv, pvm_trecv, or pvm_nrecv.

okay so here's the tea: pvm_psend is asynchronous. computation on the sending processor resumes as soon as the buffer is safe for reuse. this is the opposite of synchronous communication, where computation on the sending processor just halts and waits until the matching receive is executed by the receiving processor. nobody likes waiting around. ๐Ÿ’…

In C, the datatype parameter must be one of the following, depending on the type of data you're sending:

[Version 3.3.0 โ€” this parameter only determines message length, not data conversion. it only sends raw bytes]
  • PVM_STR โ€” string
  • PVM_BYTE โ€” byte
  • PVM_SHORT โ€” short
  • PVM_INT โ€” int
  • PVM_FLOAT โ€” real
  • PVM_CPLX โ€” complex
  • PVM_DOUBLE โ€” double
  • PVM_DCPLX โ€” double complex
  • PVM_LONG โ€” long integer
  • PVM_USHORT โ€” unsigned short int
  • PVM_UINT โ€” unsigned int
  • PVM_ULONG โ€” unsigned long int

In Fortran, you use the same data types that were specified for pack. matching, as you should. ๐Ÿงš

now, the PVM model guarantees the following about message order โ€” and this part is genuinely iconic, so listen up:

  • If task 1 sends message A to task 2, and then task 1 sends message B to task 2, message A will arrive at task 2 before message B. no cutting the line. ๐ŸŽŸ๏ธ
  • Moreover, if both messages arrive before task 2 does a receive, then a wildcard receive will always return message A.

and one last thing โ€” pvm_psend does not affect the state of the current outgoing message buffer (the one created by pvm_initsend and used by pvm_send). it minds its own business, respectfully. ๐Ÿ™ˆ


๐Ÿ’€ WARNINGS ๐Ÿ’€

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 is pvm_send compatible with pvm_precv). In addition, pvm_probe is not interoperable with pvm_psend.

why is this a thing, you ask? because nonstandard message headers are used for efficiency in the pvm_psend function. in the generic Unix version of PVM, though, the calls are fully interoperable, so breathe. ๐Ÿ˜ฎโ€๐Ÿ’จ

also โ€” the message tag space is <b>shared</b> between pvm_send and pvm_psend. so be careful, bestie, or you'll end up matching the wrong message (for example by using a wildcard to match the message). lowkey a trap. ๐Ÿšฉ

๐ŸŒˆ EXAMPLES ๐ŸŒˆ

C:

info = pvm_psend( tid, msgtag, array, 1000, PVM_FLOAT );

Fortran:

CALL PVMFPSEND( TID, MSGTAG, BUF, CNT, REAL4, INFO )

๐Ÿ”ฅ ERRORS ๐Ÿ”ฅ

these are the error conditions that pvm_psend can throw back at you:

  • PvmBadParam โ€” you gave it an invalid tid, msgtag, or datatype. oops. ๐Ÿซ 
  • PvmSysErr โ€” pvmd is not responding. she's ghosting you. ๐Ÿ’€

๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

  • pvm_precv(3PVM)
  • pvm_send(3PVM)

and that's the whole page, bestie!! this one came from the PVM Version 3.4 manual, dated 15 March, 1994 โ€” yes she's an elder but she still ate, fr fr. ๐ŸŽ€โœจ go send some raw bytes, you've got this. ๐Ÿ’œ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from