📄 mpid_segment.tex
字号:
\startmanpage\mantitle{MPID{\tt \char`\_}Segment}{tex}{10/7/2002}\manname{MPID{\tt \char`\_}Segment}--- Description of the Segment data structure \subhead{Synopsis}\startvb\begin{verbatim}typedef struct { void *ptr; int bytes; int alloc_bytes; /* For a receive buffer, this may > bytes */ /* stuff to manage pack/unpack */ MPID_Dataloop_stackelm loopstack[MPID_MAX_DATATYPE_DEPTH]; int cur_sp; /* Current stack pointer when using loopinfo */ int valid_sp; /* maximum valid stack pointer. This is used to maintain information on the stack after it has been placed there by following the datatype field in a MPID_Dataloop for any type except struct */ /* other, device-specific information */} MPID_Segment;\end{verbatim}\endvb\subhead{Notes}This has no corresponding MPI object.\parThe dataloop stack works as follows (the actual code will of courseoptimize the access to the stack elements and eliminate, for example,the various array references):\begin{verbatim} cur_sp=valid_sp=0; stackelm[cur_sp].loopinfo = datatype->loopinfo; stackelm[cur_sp].loopinfo.curcount = 0; while (cur_sp >= 0) { if stackelm[cur_sp].loopinfo.kind is final then // final means simple, consisting of basic datatypes, such // as a vector datatype made up of bytes or doubles) process datatype (this uses loopinfo.kind to pick the correct code fragments; we may also include some alignment tests so that longer word moves may be used for short (e.g., one or two word) blocks). We can also choose to stop and return here when, for example, we have filled an output buffer. cur_sp--; else if stackelm[cur_sp].curcount == stackelm[cur_sp].loopinfo.cm_t.count then { // We are done with the datatype. cur_sp--; } else { // need to push a datatype. Two cases: struct or other if (stackelm[cur_sp].loopinfo.kind == struct_type) { stackelm[cur_sp+1].loopinfo = stackelm[cur_sp].loopinfo.s_t.dataloop[stackelm[cur_sp].curcount]; } else { if (valid_sp <= cur_sp) { stackelm[cur_sp+1].loopinfo = stackelm[cur_sp].loopinfo.cm_t.dataloop; valid_sp = cur_sp + 1; } } stackelm[cur_sp].curcount++; cur_sp ++; stackelm[cur_sp].curcount = 0; } }\end{verbatim}\parThis may look a little bit messy (and not all of the code is here),but it shows how {\tt valid{\tt \char`\_}sp} is used to avoid recopying theinformation contained in a dataloop in the non-struct case. For example, avector of vector has the dataloop description read only once, notonce for each count of the outer vector.\parNote that a relatively small value of {\tt MPID{\tt \char`\_}MAX{\tt \char`\_}DATATYPE{\tt \char`\_}DEPTH}, such as{\tt 16}, will allow the processing of extremely complex datatypes thatdescribe huge amounts of memory. Thus, an {\tt MPID{\tt \char`\_}Segment} is a smallobject.\par\subhead{Module}Segment-DS\par\subhead{Questions}Should this have an id for allocation and similarity purposes?\parDo we really need to specify the contents of the {\tt MPID{\tt \char`\_}Segment}structure?\parShould we allow the {\tt MPID{\tt \char`\_}Dataloop{\tt \char`\_}stackelm} to be a pointer, sothat we can allocate a larger stack?\endmanpage
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -