PSEND(3PVM)
๐ 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:msgtagshould 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 thatbufpoints 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โ 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, 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 usingpvm_psendmust be received only bypvm_precv. Likewise, those sent withpvm_sendmust be received bypvm_recv,pvm_nrecvorpvm_trecv.pvm_psendis not compatible withpvm_recv(nor ispvm_sendcompatible withpvm_precv). In addition,pvm_probeis not interoperable withpvm_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> betweenpvm_sendandpvm_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 invalidtid,msgtag, ordatatype. oops. ๐ซPvmSysErrโpvmdis 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
- 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