⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mpid_comm_context_id.tex

📁 刚才是说明 现在是安装程序在 LINUX环境下进行编程的MPICH安装文件
💻 TEX
字号:
\startmanpage\mantitle{MPID{\tt \char`\_}Comm{\tt \char`\_}context{\tt \char`\_}id}{tex}{10/7/2002}\manname{MPID{\tt \char`\_}Comm{\tt \char`\_}context{\tt \char`\_}id}--- Determine a new context id for a communicator \subhead{Synopsis}\startvb\begin{verbatim}int MPID_Comm_context_id( MPID_Comm *old_comm, MPID_Group *new_group )\end{verbatim}\endvb\subhead{Input Parameters}\startarg{old{\tt \char`\_}comm }{Call is collective over old{\tt \char`\_}comm.  }\startarg{new{\tt \char`\_}group }{Group of new communicator.  This may be an existing group (with an incremented reference count), a new group createdwith {\tt MPID{\tt \char`\_}Group{\tt \char`\_}new}, or {\tt NULL} (see below).}\par\subhead{Return value}A context id that may be used, along with {\tt old{\tt \char`\_}comm} and {\tt new{\tt \char`\_}group},in a call to {\tt MPID{\tt \char`\_}Comm{\tt \char`\_}create} to create a new group.\par\par\subhead{Notes}Determining a value for {\tt context{\tt \char`\_}id} in the multithreaded case is not easy.The simplest algorithms can dead-lock in a valid program.  Consider thiscase:(this isn't right yet)\begin{verbatim}  process 1                      process 2  thread 1        thread2          thread1        thread2  Comm_dup(comm1)                                 Comm_dup(comm2)                  Comm_dup(comm2)  Comm_dup(comm1)       \end{verbatim}If, inside the implementation of {\tt Comm{\tt \char`\_}dup}, each {\em process} holds alock on a global {\tt context{\tt \char`\_}id} stack while a{\em thread} does a collective operation (such as an {\tt MPI{\tt \char`\_}Allreduce}), thisvalid code will hang.\parThere is a way to avoid the process lock at the cost of additionalcollective operations.  The steps necessary to get a new {\tt context{\tt \char`\_}id}are sketched below:\begin{verbatim}  MPI_Allreduce( over bitmask of available values )  Find candidate value.  if not MPI_THREAD_MULTIPLE, reserve and return that value.  Try to reserve that value (another thread may already have, so this  step may fail)  MPI_Allreduce( over success at reserving value )  if all processes successful, return that value  release that value  Return to the top  \end{verbatim}This can live-lock; a more sophisticated algorithm would keep track ofwho was reserving context ids and provide a deterministic way to breaklivelock.  See the MPICH Design Document for a more sophisticated version.\parThis routine is part of ADI-3 because some devices may be able tocreate new context ids with lower overhead than the generic implemention.Consider a shared-memory system.Let there be a global queue of available context ids.  The lowest rankprocess in the old communicator uses an atomic operation to remove thenext value from the queue, and then broadcasts it to the members of the(old) communicator using a private context id (e.g., the private communicatorused in MPICH-1).  Freeing a communicator returns the context id to theshared pool.\parRather than provide a way to return multiple context values, this routineshould be used to return a single basic value that can be multiplied bya power of two in order to provide a cluster of consequtive values.\par\subhead{Module}Communicator\par\endmanpage

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -