MPI1—C语言接口速查

主要为6个接口:

MPI_Init(&argc, &argv);//其中&argc, &argv为参数,完成MPI程序的初始化工作
MPI_Finalize();//程序结束标识,结束MPI程序的运行,也是MPI程序的最后一条可执行语句
MPI_Comm_rank(MPI_COMM_WORLD, &rank);//对于当前进程进程号,用于与其他的进程进行区分
MPI_Comm_size(MPI_COMM_WORLD, &size);//进程的个数
MPI_Send(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)//将发送缓冲区中的count个datatype数据类型的数据发送到目的进程,目的进程在通信域中的标志号是dest,本次发送的消息标志是tag
MPI_Recv(void* buf, int count, MPI_Datatype datatype, int source, int tag,MPI_Comm comm, MPI_Status *status)//MPI_RECV是从指定的进程source结合搜消息,并且该消息的数据类型和消息标识好本接收进程指定的datatype和tag相一致,接收到的消息所包含的数据元素的个数最多不超过count

MPI1中所欲的C语言接口:

int MPI_Abort(MPI_Comm comm, int errorcode)
终止MPI环境及MPI程序的执行
int MPI_Address(void * location, MPI_Aint * address)
得到给定位置在内存中的地址将被废弃的函数建议用MPI_Get_address取代
int MPI_Allgather(void * sendbuff, int sendcount, MPI_Datatype sendtype, void * recvbuf, int *
recvcounts, int * displs, MPI_Datatype recvtype, MPI_Comm comm)
每一进程都从所有其它进程收集数据相当于所有进程都执行了一个MPI_Gather调
用
int MPI_Allgatherv(void * sendbuff, int sendcount, MPI_Datatype sendtype, void * recvbuf, int
recvcounts, int * displs, MPI_Datatype recvtype, MPI_Comm comm)
所有进程都收集数据到指定的位置就如同每一个进程都执行了一个MPI_Gatherv调
用
int MPI_Allreduce(void * sendbuf, void * recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
MPI_Comm comm)
归约所有进程的计算结果并将最终的结果传递给所有其它的进程相当于每一个进
程都执行了一次MPI_Reduce调用
int MPI_Alltoall(void * sendbuf, void * recvbuf, int count, MPI_Datatype datatype, void * recvbuf,
int * recvcounts, int * rdispls, MPI_Datatype recvtype, MPI_Comm comm)
所有进程相互交换数据
int MPI_Alltoallv(void * sendbuf, int * sendcount, int * sdispls, MPI_Datatype sendtype, void *
recvbuf, int * recvcounts, int * rdispls, MPI_Datatype recvtype, MPI_Comm comm)
所有进程相互交换数据, 但数据有一个偏移量
Int MPI_Attr_delete(MPI_Comm comm, int keyval)
删除与指定关键词联系的属性值即将废弃的特性建议用MPI_Comm_delete_attr替
代
int MPI_Attr_get(MPI_Comm comm, int keyval, void * attribute_val, int * flag)
按关键词查找属性值即将废弃的特性建议用MPI_Comm_get_attr替代
int MPI_Attr_put(MPI_Comm comm, int keyval, void * attribute_val)
按关键词设置属性值即将废弃的特性建议用MPI_Comm_set_attr替代
int MPI_Barrier(MPI_Comm comm)
等待直到所有的进程都执行到这一例程才继续执行下一条语句
int MPI_Bcast(void * buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm)
将root进程的消息广播到所有其它的进程
int MPI_Bsend(void * buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)
使用用户声明的缓冲区进行发送
int MPI_Bsend_init(void * buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm
comm, MPI_Request * request)
建立发送缓冲句柄
int MPI_Buffer_attach(void * buffer, int size)
将一个用户指定的缓冲区用于消息发送的目的
int MPI_Buffer_detach(void * buffer, int * size)
移走一个指定的发送缓冲区
int MPI_Cancel(MPI_Request * request)
取消一个通信请求
int MPI_Cart_coords(MPI_Comm comm, int rank, int maxdims, int * coords)
给出一个进程所在组的标识号得到其卡氏坐标值
int MPI_Cart_create(MPI_Comm comm_old, int ndims, int * dims, int * periods, int reorder,
MPI_Comm * comm_cart )
按给定的拓扑创建一个新的通信域
int MPI_Cart_get(MPI_Comm comm, int maxdims, int * dims, int *periods, int * coords)
得到给定通信域的卡氏拓扑信息
int MPI_Cart_map(MPI_Comm comm, int * ndims, int * periods, int * newrank)
将进程标识号映射为卡氏拓扑坐标
int MPI_Cart_rank(MPI_Comm comm, int * coords, int * rank)
由进程标识号得到卡氏坐标
int MPI_Cart_shift(MPI_Comm comm, int direction, int disp, int * rank_source, int * rank_dest)
给定进程标识号平移方向与大小得到相对于当前进程的源和目的进程的标识号
int MPI_Cart_sub(MPI_Comm comm, int * remain_dims, MPI_Comm * newcomm)
将一个通信域保留给定的维得到子通信域
int MPI_Cartdim_get(MPI_Comm comm, int* ndims)
得到给定通信域的卡氏拓扑
int MPI_Comm_compare(MPI_comm comm1, MPI_Comm comm2, int * result)
两个通信域的比较
int MPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm * newcomm)
根据进程组创建新的通信域
Int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *new_comm)
通信域复制
int MPI_Comm_free(MPI_Comm* comm)
释放一个通信域对象
int MPI_Comm_group(MPI_Comm comm, MPI_Group * group)
由给定的通信域得到组信息
int MPI_Comm_rank(MPI_Comm comm, int * rank)
得到调用进程在给定通信域中的进程标识号
int MPI_Comm_remote_group(MPI_Comm comm, MPI_Group * group)
得到组间通信域的远程组
int MPI_Comm_remote_size(MPI_Comm comm, int * size)
得到远程组的进程数
int MPI_Comm_set_attr(MPI_Comm comm, int keyval, void * attribute_val)
根据关键词保存属性值
int MPI_Comm_size(MPI_Comm comm, int * size)
得到通信域组的大小
int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm * newcomm)
按照给定的颜色和关键词创建新的通信域
int MPI_Comm_test_inter(MPI_Comm comm, int * flag)
测试给定通信域是否是域间域
int MPI_Dims_create(int nnodes, int ndims, int * dims)
在卡氏网格中建立进程维的划分
int MPI_Errhandler_create(MPI_handler_function * function, MPI_Errhandler * errhandler)
创建MPI错误句柄过时特性建议用MPI_Comm_create_errhandler替代
int MPI_Errhandler_free(MPI_Errhandler * errhandler)
释放MPI错误句柄
int MPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler * errhandler)
得到给定通信域的错误句柄即将废弃的特性建议用MPI_Comm_get_errhandler代替
int MPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler)
设置MPI错误句柄即将废弃的特性建议用MPI_Comm_set_errhandler代替
int MPI_Error_class(int errorcode, int * errorclass)
将错误代码转换为错误类
int MPI_Error_string(int errorcode, char * string, int * resultlen)
由给定的错误代码返回它所对应的字符串
int MPI_Finalize(void)
结束MPI运行环境
int MPI_Gather(void * sendbuf, int sendcount, MPI_Datatype sendtype, void * recvbuf, int
recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
从进程组中收集消息
int MPI_Gatherv(void * sendbuf, int sendcount, MPI_Datatype sendtype, void * recvbuf, int *
recvcounts, int * displs, MPI_Datatype recvtype, int root, MPI_Comm comm)
从进程组中收集消息到指定的位置
int MPI_Get_count(MPI_Status * status, MPI_Datatype datatype, int * count)
得到以给定数据类型为单位的数据的个数
int MPI_Get_elements(MPI_Statue * status, MPI_Datatype datatype, int * elements)
返回给定数据类型中基本元素的个数
int MPI_Get_processor_name(char * name, int * resultlen)
得到处理器名称
int MPI_Get_version(int * version, int * subversion)
返回MPI的版本号
int MPI_Graph_create(MPI_Comm comm_old, int nnodes, int * index, int * edges, int reorder,
MPI_Comm * comm_graph)
按照给定的拓扑创建新的通信域
int MPI_Graph_get(MPI_Comm comm, int maxindex, int maxedges, int * index, int * edges)
得到给定通信域的处理器拓扑结构
int MPI_Graph_map(MPI_Comm comm, int nnodes, int * index, int * edges, int * newrank)
将进程映射到给定的拓扑
int MPI_Graph_neighbors_count(MPI_Comm comm, int rank, int * nneighbors)
给定拓扑返回给定结点的相邻结点数
int MPI_Graph_neighbors(MPI_Comm comm, int rank, int * maxneighbors, int * neighbors)
给定拓扑返回给定结点的相邻结点
int MPI_Graphdims_Get(MPI_Comm comm, int * nnodes, int * nedges)
得到给定通信域的图拓扑
int MPI_Group_compare(MPI_Group group1, MPI_Group group2, int * result)
比较两个组
int MPI_Group_diffenence(MPI_Group group1, MPI_Group group2, MPI_Group * newgroup)
根据两个组的差异创建一个新组
int MPI_Group_excl(MPI_Group group, int n, int * ranks, MPI_Group * newgroup)
通过重新对一个已经存在的组进行排序, 根据未列出的成员创建一个新组
int MPI_Group_free(MPI_Group * group)
释放一个组
int MPI_Group_incl(MPI_Group group, int n, int * ranks, MPI_Group * newgroup)
通过重新对一个已经存在的组进行排序, 根据列出的成员创建一个新组
int MPI_Group_intersection(MPI_Group group1, MPI_Group group2, MPI_Group * newgroup)
根据两个已存在组的交创建一个新组
int MPI_Group_range_excl(MPI_Group group, int n, int ranges[][3], MPI_group * newgroup)
根据已存在的组, 去掉指定的部分, 创建一个新组
int MPI_Group_range_incl(MPI_Group group, int n, int ranges[][3], MPI_Group * newgroup)
根据已存在的组, 按照指定的部分, 创建一个新组
int MPI_Group_rank(MPI_Group group, int * rank)
返回调用进程在给定组中的进程标识号
int MPI_Group_size(MPI_Group group, int * size)
返回给定组的大小
int MPI_Group_translate_ranks(MPI_Group group1, int n, int * ranks1, MPI_Group group2, int *ranks2)
将一个组中的进程标识号转换成另一个组的进程标识号
int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group * newgroup)
将两个组合并为一个新组
int MPI_Ibsend(void * buf, int count, MPI_Datatype datatype, int dest, int tga, MPI_Comm comm,
MPI_Request * request)
非阻塞缓冲区发送
int MPI_Init(int * argc, char *** argv)
MPI执行环境初始化
Int MPI_Initialized(int * flag)
查询MPI_Init是否已经调用
int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm,
int remote_leader, int tag, MPI_Comm * newintercomm)
根据两个组内通信域创建一个组间通信域
int MPI_Intercomm_merge(MPI_Comm intercomm, int high, MPI_Comm * newintracomm)
根据组间通信域创建一个组内通信域
int MPI_Iprobe(int source, int tag, MPI_Comm comm, int * flag, MPI_Status * status)
非阻塞消息到达与否的测试
int MPI_Irecv(void * buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm,
MPI_Request * request)
非阻塞接收
int MPI_Irsend(viud * buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm,
MPI_Request * request)
非阻塞就绪发送
int MPI_Isend(void * buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm,
MPI_Request * request)
非阻塞发送
int MPI_Issend(void * buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm,
MPI_Request * request)
非阻塞同步发送
int MPI_Keyval_create(MPI_Copy_function * copy_fn, MPI_Delete_function * delete_fn, int *
keyval, void * extra_state)
创建一个新的属性关键词即将废弃的特性, 建议用MPI_Comm_create_keyval代替
int MPI_Keyval_free(int * keyval)
释放一个属性关键词
int MPI_Op_create(MPI_Uop function, int commute, MPI_Op * op)
创建一个用户定义的通信函数句柄
int MPI_Op_free(MPI_Op * op)
释放一个用户定义的通信函数句柄
int MPI_Pack(void * inbuf, int incount, MPI_Datatype datetype, void * outbuf, int outcount, int *
position, MPI_Comm comm)
将数据打包, 放到一个连续的缓冲区中
int MPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int * size)
返回需要打包的数据类型的大小
int MPI_Pcontrol(const int level)
控制剖视
int MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status * status)
阻塞消息测试
int MPI_Recv(void * buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm,
MPI_Status * status)
标准接收
int MPI_Recv_init(void * buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm
comm, MPI_Request * request)
创建接收句柄
int MPI_Reduce(void * sendbuf, void * recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
int root, MPI_Comm comm)
将所进程的值归约到root进程, 得到一个结果
int MPI_Reduce_scatter(void * sendbuf, void * recvbuf, int * recvcounts, MPI_Datatype datatype,
MPI_Op op, MPI_Comm comm)
将结果归约后再发送出去
int MPI_Request_free(MPI_Request * request)
释放通信申请对象
int MPI_Rsend(void * buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)
就绪发送
int MPI_Rsend_init(void * buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm
comm, MPI_Request * request)
创建就绪发送句柄
int MPI_Scan(void * sendbuf, void * recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
MPI_Comm comm)
在给定的进程集合上进行扫描操作
int MPI_Scatter(void * sendbuf, int sendcount, MPI_Datatype sendtype, void * recvbuf, int
recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
将数据从一个进程发送到组中其它进程
int MPI_Scatterv(void * sendbuf, int * sendcounts, int * displs, MPI_Datatype sendtype, void *
recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
将缓冲区中指定部分的数据从一个进程发送到组中其它进程
int MPI_Send(void * buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)
标准的数据发送
int MPI_Send_init(void * buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm
comm, MPI_Request * request)
创建一个标准发送的句柄
int MPI_Sendrecv(void * sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag,
void * recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm
comm, MPI_Status * status)
同时完成发送和接收操作
int MPI_Sendrecv_replace(void * buf, int count, MPI_Datatype datatype, int dest, int sendtag, int
source, int recvtag, MPI_Comm comm, MPI_Status * status)
用同一个发送和接收缓冲区进行发送和接收操作
int MPI_Ssend(void * buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)
同步发送
int MPI_Ssend_init(void * buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm
comm, MPI_Request * request)
创建一个同步发送句柄
int MPI_Start(MPI_Request * request)
启动给定对象上的重复通信请求
int MPI_Startall(int count, MPI_Request * array_of_requests)
启动指定的所有重复通信请求
int MPI_Test(MPI_Request * request, int * flag, MPI_Status * status)
测试发送或接收是否完成
int MPI_Testall(int count, MPI_Request * array_of_requests, int * flag, MPI_Status *
array_of_statuses)
测试前面所有的通信是否完成
int MPI_Testany(int count, MPI_Request * array_of_requests, int * index, int * flag, MPI_Status *
status)
测试前面任何一个通信是否完成
int MPI_Testsome(int incount, MPI_Request * array_of_requests, int * outcount, int *
array_of_indices, MPI_Status * array_of_statuses)
测试是否有一些通信已经完成
int MPI_Test_cancelled(MPI_Status * status, int * flag)
测试一个请求对象是否已经删除
int MPI_Topo_test(MPI_Comm comm, int * top_type)
测试指定通信域的拓扑类型
int MPI_Type_commit(MPI_Datatype * datatype)
提交一个类型
int MPI_Type_contiguous(int count, MPI_Datatype oldtype, MPI_Datatype * newtype)
创建一个连续的数据类型
int MPI_Type_extent(MPI_Datatype datatype, MPI_Aint * extent)
返回一个数据类型的范围即将废弃的特性, 建议使用MPI_type_get_extent来代替
int MPI_Type_free(MPI_Datatype * datatype)
释放一个数据类型
int MPI_Type_hindexed(int count, int * array_of_blocklengths, MPI_Aint *
array_of_displacements, MPI_Datatype oldtype, MPI_Datatype * newtype)
按照字节偏移, 创建一个数据类型索引即将废弃的特性, 建议使用
MPI_type_create_hindexed来代替
int MPI_Type_hvector(int count, int blocklength, MPI_Aint stride, MPI_Datatype oldtype,
MPI_Datatype * newtype)
根据以字节为单位的偏移量, 创建一个向量数据类型即将废弃的特性, 建议使用
MPI_type_create_hvector来代替
int MPI_Type_indexed(int cont, int * array_of_blocklengths, int * array_of_displacements,
MPI_Datatype oldtype, MPI_Datatype * newtype)
创建一个索引数据类型
int MPI_Type_lb(MPI_Datatype datatype, MPI_Aint * displacement)
返回指定数据类型的下边界即将废弃的特性, 建议使用MPI_type_get_extent来代替
int MPI_Type_size(MPI_Datatype datatype, int * size)
以字节为单位, 返回给定数据类型的大小
int MPI_Type_struct(int count, int * array_of_blocklengths, MPI_Aint * array_of_displacements,
MPI_Datatype * array_of_types, MPI_Datatype * newtype)
创建一个结构数据类型即将废弃的特性, 建议使用MPI_type_create_struct来代替
int MPI_Type_ub(MPI_Datatype datatype, MPI_Aint * displacement)
返回指定数据类型的上边界即将废弃的特性, 建议使用MPI_type_get_extent来代替
int MPI_Type_vector(int count, int blocklength, int stride, MPI_Datatype oldtype, MPI_Datatype *
newtype)
创建一个向量数据类型
int MPI_Unpack(void * inbuf, int insize, int * position, void * outbuf, int outcount, MPI_Datatype
datatype, MPI_Comm comm)
从连续的缓冲区中将数据解开
int MPI_Wait(MPI_Request * request, MPI_Status * status)
等待MPI的发送或接收语句结束
int MPI_Waitall(int count, MPI_Request * array_of_requests, MPI_Status * array_of_status)
等待所有给定的通信结束
int MPI_Waitany(int count, MPI_Request *array_of_requests, int *index,MPI_Status *status)
等待某些指定的发送或接收完成
int MPI_Waitsome(int incount, MPI_Request * array_pf_requests, int * outcount, int *
array_of_indices, MPI_Status * array_of_statuses)
等待一些给定的通信结束
double MPI_Wtick(void)
返回MPI_Wtime的分辨率
double MPI_Wtime(void)
返回调用进程的流逝时间

读书笔记

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值