MPI中的函数及关键结构

摘自http://www.mcs.anl.gov/research/projects/mpi/www/www3/MPI_Allreduce.html

Computes the scan (partial reductions) of data on a collection of processes

Synopsis

int MPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, 
             MPI_Op op, MPI_Comm comm)

Input Parameters

sendbuf
starting address of send buffer (choice)
count
number of elements in input buffer (integer)
datatype
data type of elements of input buffer (handle)
op
operation (handle)
comm
communicator (handle)

Output Parameter

recvbuf

starting address of receive buffer (choice)

下段摘自http://micro.ustc.edu.cn/Linux/MPI/MPICH/mpi411.htm

MPI_SCAN常用于对分布于组中的数据作前置归约操作.此操作将序列号为0,... ,i(包括i)的进程发送缓冲区的值的归约结果存入序列号为i 的进程的接收消息缓冲区中,这种操作支持的类型、语义以及对发送及接收缓冲区的限制和MPI_REDUCE相同.

意即:前一个进程缓冲区的结果与当前进程缓冲区的值为MPI_scan的操作数。



发现一个问题,时间久了就忘了

cite from

http://www.netlib.org/utk/papers/mpi-book/node31.html

http://www.mpi-forum.org/docs/mpi21-report/node45.htm

In C, status is a structure of type MPI_Status that contains three fields named MPI_SOURCE, MPI_TAG, and MPI_ERROR; the structure may contain additional fields. Thus, status.MPI_SOURCE, status.MPI_TAG and status.MPI_ERROR contain the source, tag and error code, respectively, of the received message.

In Fortran, status is an array of INTEGERs of length MPI_STATUS_SIZE. The three constants MPI_SOURCE, , MPI_TAG and MPI_ERROR  are the indices of the entries that store the source, tag and error fields. Thus status(MPI_SOURCE), status(MPI_TAG) and status(MPI_ERROR) contain, respectively, the source, the tag and the error code of the received message.

The status argument also returns information on the length of the message received. However, this information is not directly available as a field of the status variable and a call to MPI_GET_COUNT is required to ``decode'' this information.



MPI_BCast

注意点:

要使当前处理器也得到MPI_Bcast的结果,要确保当前处理器上也调用了MPI_Bcast
如果当前处理器上(接收MPI_Bcast结果的处理器)未调用MPI_BCast语句,则无法获取广播的值





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值