不同MPI_Datatypes的发送者和接收者 [英] Different MPI_Datatypes for Sender and Receiver

查看:131
本文介绍了不同MPI_Datatypes的发送者和接收者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用MPI,可以将数据发送,并与从相同的基本类型衍生并具有相同的总长度不同MPI_Datatypes接收

With MPI, can data be sent and received with different MPI_Datatypes that are derived from the same base type and have the same total length?

考虑两个MPI进程的 A A 有一个数组双A [N] 有一个数组重B [ M] 。这两个进程知道的 A 想要发送以某种方式分布在 K 双打(仅 A 有知识,这个分布)。 (也是唯一的)知道它是怎么想安排 K 双打b 。因此,无论创建(通过 MPI_Type_indexed MPI_Type_commit ),它对于 A 对应​​的数据类型它希望发送的元素从 A 对应​​于它希望这些元素在保存b <位置/ code>。 A 通话 MPI_Isend(一,1,A_datatype,...)通话 MPI_Irecv(二,1,B_datatype,...)

Consider two MPI processes A and B. A has an array double a[n] and B has an array double b[m]. Both processes know that A wants to send B k doubles that are somehow distributed in a (only A has knowledge about this distribution). B (and only B) knows how it wants to arrange the k doubles in b. So both create (via MPI_Type_indexed and MPI_Type_commit) a datatype that for A corresponds to the elements it wants to send from a and for B corresponds to the locations it wants to save these elements to in b. A calls MPI_Isend(a, 1, A_datatype, ...) and B calls MPI_Irecv(b, 1, B_datatype, ...).

工作的呢?如果是的话,这是标准的方式来解决手头的问题?如果没有,怎么就是这样一个数据交换常见的做?

Does this work? If yes, is this the standard way to solve the problem at hand? If no, how is such a data exchange commonly done?

推荐答案

是的,它的工作原理,这是相当来解决它的标准方式。

Yes, it works, and it's quite a standard way to solve it.

数据类型是刚刚的如何包装在发送方的数据的指令,而如何在接收器来说解压它们的指令。

The datatype is just instruction on how to pack data at the sender side, and instruction on how to unpack them at the receiver one.

这是一个非常有用的,并与MPI-IO一个非常标准的做法。

This is a very useful and a very standard approach with MPI-IO.

这篇关于不同MPI_Datatypes的发送者和接收者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆