📄 mpid_rhcv.tex
字号:
\startmanpage\mantitle{MPID{\tt \char`\_}Rhcv}{tex}{10/7/2002}\manname{MPID{\tt \char`\_}Rhcv}--- Invoke a predefined handler on another process \subhead{Synopsis}\startvb\begin{verbatim}int MPID_Rhcv( int rank, MPID_Comm *comm, MPID_Handler_id id, const struct iovec vector[], int count, int *local_flag )\end{verbatim}\endvb\subhead{Input Parameters}\startarg{rank }{Rank of process to invoke handler on}\startarg{comm }{Communicator that rank is relative to}\startarg{id }{Id of handler}\startarg{vector }{vector of {\tt struct iovec} elements containing information tobe delivered to the remote handler. }\startarg{count }{Number of elements in {\tt vector}}\par\subhead{Output Parameter}\startarg{local{\tt \char`\_}flag }{The location specified by this pointer is set to onewhen the operation has completed.}\par\subhead{Notes}The first element of {\tt vector} points to a predefined handler datatype thatcorresponds to the handler {\tt id}; the remaining elements are data thatthe handler operation needs. The handler {\tt id} can restrict the type ofmemory that {\tt vector} may point at (e.g., it may require memory allocatedwith {\tt MPID{\tt \char`\_}Mem{\tt \char`\_}alloc}).\parThe C struct type {\tt iovec} is defined in {\tt $<$sys/uio.h$>$} and is thesame structure used by the Unix {\tt readv} and {\tt writev} routines. It has themembers\startarg{iov{\tt \char`\_}base }{Address of block}\startarg{iov{\tt \char`\_}len }{Length of block in bytes.}\par{\tt MPID{\tt \char`\_}Rhcv} is a nonblocking operation. No buffer described by the {\tt vector}argument may be modified until the {\tt local{\tt \char`\_}flag} is set.\parWhen used to invoke the predefined handlers, the first element (that is,{\tt vector[0]}) specifies the handler structure. For example, to issue arequest-to-send operation, the code might look something like the following:\begin{verbatim} MPID_Hid_Request_to_send_t *ptr = <code to allocate this type> struct iovec vector[1]; ... ptr->tag = tag; ptr->context_id = context_id; ... vector[0].iov_base = ptr; vector[0].iov_len = sizeof(*ptr); ... err = MPID_Rhcv( rank, comm, MPID_Hid_Request_to_send, vector, 1, &local_flag );\end{verbatim}\parThere is no requirement the that requested handler be invoked duringthe call to the routine. In fact, this routine can be implemented,particularly in a TCP method, by simply sending a message to thedesignated process. In fact, since this routine may locally complete(in the MPI sense), in the case where messages must be temporarilybuffered at the sender (because of flow control limits or a fullsocket buffer), the message may not even have been sent by the timeit returns.\parWhen this routine returns, all parameters may be reused. Forexample, the {\tt vector} argument can be allocated off of the stack; if{\tt MPID{\tt \char`\_}Rhcv} hasn't sent the message or invoked the handler by thetime it returns, {\tt MPID{\tt \char`\_}Rhcv} will make an internal copy of thecontents of {\tt vector} (that is, the elements of the vector, not whatthey point at).\par\subhead{Module}MPID{\tt \char`\_}CORE\par\subhead{Discussion}Earlier drafts of ADI-3 contained the routine {\tt MPID{\tt \char`\_}Rhc} as a specialcase of {\tt MPID{\tt \char`\_}Rhcv}; this special case provided a slightly moreconvenient interface for the case of a single block (e.g., for a {\tt count}of {\tt 1}). However, many operations would not use this special case.Here are 2 examples:\parThe Stream routines define a separate header which is used to supportthe generic implementation of the MPI collective operations. To supportthis, a count of at least 2 will be needed, with {\tt vector[0]} pointing atthe packet describing the stream operation and {\tt vector[1]} pointing at theseparate header.\parAn {\tt MPI{\tt \char`\_}Put} with a (noncontiguous) datatype will needsa count of at least 3: {\tt vector[0]} points to the header thatdescribes the basic put operation (window and offset), {\tt vector[1]} pointsto a description of the datatype (if not cached at the destination),and {\tt vector[2]} points to the actual data.\parIn terms of implementation, for a put to a strided datatype using TCP,we'd want to send the header describing the destination, the datatypedescription, and the data. In a shared-memory case, where the destinationwindow is in shared-memory, this routine may run locally. Alternately,or where the window is not in shared-memory, the shared-memory verisoncould move some of the data into a shared-memory destination location andenqueue an handler-activation request at the destination process.\par\subhead{Threads and Polling}This routine is designed to allow (for most operations) either athreaded or a polling implementation. For each {\tt id} (i.e., operationtype), the operation specifies whether a polling implementation isallowed. Since each operation is defined by an id rather than afunction pointer, the implementation of {\tt MPID{\tt \char`\_}Rhcv} can use the {\tt id}value to decide how to implement each operation. In the simplestimplementation, {\tt MPID{\tt \char`\_}Rhcv} could send a message to a thread runningin the destination process and that thread could execute a functionto process the request. However, other implementations are possible.For example, based on the {\tt id} value, messages could be sent to apolling routine or a thread agent. In the simple TCP case, separatesockets could be used for actions requiring a thread and those thatcan be handled by polling. In an implementation with shared memory,some operations can be handled directly without invoking any code at thedestination process (for example, a window lock could access thewindow directly).\par\subhead{Questions and Discussion}How many handler functions need be written to implement the core?What handler types are in the core?\parShould there be a multisend version of this (one that can send thesame data to multiple destinations)?\parShould this routine know how to recover memory (e.g., the request-to-sendstructure in the example above) when the operation completes? Should itreturn an indication that the message has been sent or not, allowing thecalling routine to figure out whether it needs to handle the non-blockingnature of the operation?\endmanpage
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -