1NRECV(3PVM) PVM Version 3.4 NRECV(3PVM)
2
3
4
6 pvm_nrecv - Non-blocking receive.
7
8
10 C int bufid = pvm_nrecv( int tid, int msgtag )
11
12 Fortran call pvmfnrecv( tid, msgtag, bufid )
13
14
16 tid Integer task identifier of sending process supplied by the
17 user.
18
19 msgtag Integer message tag supplied by the user. msgtag should be >=
20 0.
21
22 bufid Integer returning the value of the new active receive buffer
23 identifier. Values less than zero indicate an error.
24
25
27 The routine pvm_nrecv checks to see if a message with label msgtag has
28 arrived from tid. and also clears the current receive buffer if any,
29 If a matching message has arrived pvm_nrecv immediately places the mes‐
30 sage in a new active receive buffer, and returns the buffer identifier
31 in bufid.
32
33 If the requested message has not arrived, then pvm_nrecv immediately
34 returns with a 0 in bufid. If some error occurs bufid will be < 0.
35
36 A -1 in msgtag or tid matches anything. This allows the user the fol‐
37 lowing options. If tid = -1 and msgtag is defined by the user, then
38 pvm_nrecv will accept a message from any process which has a matching
39 msgtag. If msgtag = -1 and tid is defined by the user, then pvm_nrecv
40 will accept any message that is sent from process tid. If tid = -1 and
41 msgtag = -1, then pvm_nrecv will accept any message from any process.
42
43 The PVM model guarantees the following about message order. If task 1
44 sends message A to task 2, then task 1 sends message B to task 2, mes‐
45 sage A will arrive at task 2 before message B. Moreover, if both mes‐
46 sages arrive before task 2 does a receive, then a wildcard receive will
47 always return message A.
48
49 pvm_nrecv is non-blocking in the sense that the routine always returns
50 immediately either with the message or with the information that the
51 message has not arrived at the local pvmd yet. pvm_nrecv can be called
52 multiple times to check if a given message has arrived yet. In addi‐
53 tion the blocking receive pvm_recv can be called for the same message
54 if the application runs out of work it could do before the data
55 arrives.
56
57 If pvm_nrecv returns with the message, then the data in the message can
58 be unpacked into the user's memory using the unpack routines.
59
60
62 C:
63 tid = pvm_parent();
64 msgtag = 4 ;
65 arrived = pvm_nrecv( tid, msgtag );
66 if ( arrived > 0)
67 info = pvm_upkint( tid_array, 10, 1 );
68 else
69 /* go do other computing */
70
71 Fortran:
72 CALL PVMFNRECV( -1, 4, ARRIVED )
73 IF ( ARRIVED .gt. 0 ) THEN
74 CALL PVMFUNPACK( INTEGER4, TIDS, 25, 1, INFO )
75 CALL PVMFUNPACK( REAL8, MATRIX, 100, 100, INFO )
76 ELSE
77 * GO DO USEFUL WORK
78 ENDIF
79
80
82 These error conditions can be returned by pvm_nrecv.
83
84 PvmBadParam
85 giving an invalid tid value or msgtag.
86
87 PvmSysErr
88 pvmd not responding.
89
91 pvm_bufinfo(3PVM), pvm_getminfo(3PVM), pvm_recv(3PVM),
92 pvm_unpack(3PVM), pvm_send(3PVM), pvm_mcast(3PVM)
93
94
95
96 30 August, 1993 NRECV(3PVM)