NAME
ISENDRECV - Sends a message, posts a receive for a reply,
and returns immediately. (Asynchronous send-receive)
SYNOPSIS
INCLUDE 'fnx.h'
INTEGER FUNCTION ISENDRECV(type, sbuf, scount, node, ptype,
typesel, rbuf, rcount)
INTEGER type
INTEGER sbuf(*)
INTEGER scount
INTEGER node
INTEGER ptype
INTEGER typesel
INTEGER rbuf(*)
INTEGER rcount
PARAMETERS
type Type of the message to send. Refer to Appendix A
of the Paragon(tm) System Fortran Calls Reference
Manual for more information about message types.
sbuf Buffer containing the message to send. The buffer
may be of any valid data type.
scount Number of bytes to send in the sbuf parameter.
node Node number of the message destination (the
receiving node). Setting node to -1 sends the mes-
sage to all nodes in the application (except the
sending node when ptype is the sender's process
type).
ptype Process type of the message destination (the
receiving process).
typesel Message type(s) to receive. Refer to Appendix A of
the Paragon(tm) System Fortran Calls Reference
Manual for information on message type selectors.
rbuf Buffer for storing the reply. The buffer can be of
any valid data type, but should match the data
type of the buffer in the corresponding send
operation.
rcount Length (in bytes) of the rbuf parameter.
DESCRIPTION
The isendrecv() function sends a message and immediately
posts a receive for a reply. The isendrecv() function
immediately returns a message ID that you can use with the
msgdone() and msgwait() system calls to determine when the
send-receive completes (that is, the reply arrives). When
the reply arrives, the calling process receives the message
and stores it in the rbuf buffer.
If the reply is too long for the rbuf buffer, the receive
completes with no error returned, and the content of the
rbuf buffer is undefined.
This is an asynchronous system call. The calling process
continues to run while the send-receive operation is occur-
ring. To determine if the message sent is received, do
either of the following:
o Use the msgwait() subroutine to wait until the receive
completes.
o Loop until the msgdone() function returns 1, indicating
that the receive is complete.
You can use the info...() system calls to get more informa-
tion about a message after it is received.
For synchronous message passing applications, use the csen-
drecv() function instead of the isendrecv() function.
RETURN VALUES
A message ID (mid) for use in msgcancel(), msgdone(), msgig-
nore(), msgmerge(), or msgwait() system calls
NOTE
The number of message IDs is limited. The error message
``Too many requests'' is returned and your application
will stop when no message IDs are available for a
requested asynchronous send or receive. Your program
should release its message IDs as soon as possible by
calling msgcancel(), msgdone(), msgignore(), or
msgwait().
ERRORS
NOTE
The majority of the Fortran I/O errors that you are
likely to receive are described in the ``Runtime Error
Messages'' appendix of the Paragon(tm) System Fortran
Compiler User's Guide. This section describes addi-
tional errors that you may receive.
Too many requests
Your application has used all the available message IDs and
no message IDs are available. Use either the msgcancel(),
msgdone(), msgignore(), or msgwait() subprogram with the
receive to release message IDs.
EXAMPLES
The following example shows how to use the isendrecv() func-
tion to do an asynchronous send and receive:
include 'fnx.h'
integer msgid, inode, ipid
real lbuf, value
double precision sbuf0, rbuf0, sbuf1, rbuf1
sbuf0 = 0.0
rbuf0 = 0.0
sbuf1 = 0.0
rbuf1 = 0.0
lbuf = 0.0
value = 3.14
c Identify self.
iam = mynode()
c If node 0, then ...
if(iam .eq. 0) then
print *,'Starting ...'
c Send message to other node(s) and post receive for result.
sbuf0 = 0.21381
msgid = isendrecv(10,sbuf0,8,-1,mypid(),11,rbuf0,8)
c Do some processing while waiting for results.
lbuf = sqrt(value)
write (*, 50) value, lbuf
50 format('The square root of ',F5.2, ' is ', F5.2)
c Wait for result.
call msgwait(msgid)
c Display result.
write(*, 100) sbuf0, rbuf0
100 format('Arcsin of ', d15.5, ' is ', d15.5)
c If not node 0, then ...
else
c Receive message.
call crecv(10, rbuf1, 8)
c Get sending node and pid (for returning result).
inode = infonode()
ipid = infopid()
c Get value of result.
sbuf1 = dasind(rbuf1)
c Send result to calling node.
call csend(11, sbuf1, 8, inode, ipid)
endif
end
LIMITATIONS AND WORKAROUNDS
For information about limitations and workarounds, see the
release notes files in /usr/share/release_notes.
SEE ALSO
cprobe(), crecv(), csend(), csendrecv(), hrecv(), hsend(),
hsendrecv(), iprobe(), irecv(), isend(), isendrecv(),
msgcancel(), msgdone(), msgignore(), msgmerge(), msgwait()
Acknowledgement and Disclaimer