使用MPI :: Send可以发送的最大数据量 [英] Maximum amount of data that can be sent using MPI::Send

查看:427
本文介绍了使用MPI :: Send可以发送的最大数据量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用MPI :: Isend的语法

With the syntax for MPI::Isend as

MPI::Request MPI::Comm::Isend(const void *buf, int count, 
              const MPI::Datatype& datatype, 
              int dest, int tag) const;

是受

std::numeric_limits<int>::max()

许多其他MPI函数具有int参数.这是MPI的限制吗?

Many other MPI functions have int parameter. Is this a limitation of MPI?

推荐答案

MPI-2.2将数据长度参数定义为int.在大多数64位Unix系统上,这可能是并且通常是个问题,因为int仍然是32位.此类系统称为LP64,这意味着long和指针的长度为64位,而int的长度为32位.相反,Windows x64是LLP64系统,这意味着intlong均为32位长,而long long和指针均为64位长.用于64位x86 CPU的Linux是这种类似Unix的系统LP64的示例.

MPI-2.2 defines data length parameters as int. This could be and usually is a problem on most 64-bit Unix systems since int is still 32-bit. Such systems are referred to as LP64, which means that long and pointers are 64-bit long, while int is 32-bit in length. In contrast, Windows x64 is an LLP64 system, which means that both int and long are 32-bit long while long long and pointers are 64-bit long. Linux for 64-bit x86 CPUs is an example of such a Unix-like system which is LP64.

鉴于MPI-2.2实现中所有上述所有MPI_Send的消息大小限制为2^31-1个元素.可以通过构造用户定义的类型(例如,连续类型)来克服该限制,这将减少数据元素的数量.例如,如果您注册一些基本MPI类型的2^10元素的连续类型,然后使用MPI_Send发送这种新类型的2^30元素,则将导致消息中的2^40元素基本类型.如果某些MPI实现使用int在内部处理元素计数,则在这种情况下仍可能会失败.另外,由于MPI_Get_elementsMPI_Get_count的输出count参数的类型为int,因此它也会中断.

Given all of the above MPI_Send in MPI-2.2 implementations have a message size limit of 2^31-1 elements. One can overcome the limit by constructing a user-defined type (e.g. a contiguous type), which would reduce the amount of data elements. For example, if you register a contiguous type of 2^10 elements of some basic MPI type and then you use MPI_Send to send 2^30 elements of this new type, it would result in a message of 2^40 elements of the basic type. Some MPI implementations may still fail in such cases if they use int to handle elements count internally. Also it breaks MPI_Get_elements and MPI_Get_count as their output count argument is of type int.

MPI-3.0解决了其中一些问题.例如,它提供了MPI_Get_elements_xMPI_Get_count_x操作,这些操作将MPI_Count typedef用作其count参数.定义MPI_Count以便能够保存指针值,这使得它在大多数64位系统上的长度为64位.还有其他采用MPI_Count而不是int的扩展呼叫(全部以_x结尾).保留了旧的MPI_Get_elements/MPI_Get_count操作,但是如果计数大于int输出参数可以容纳的数量,则现在它们将返回MPI_UNDEFINED(此说明在MPI-2.2标准中不存在,使用那里存在大量未定义行为).

MPI-3.0 addresses some of these issues. For example, it provides the MPI_Get_elements_x and MPI_Get_count_x operations which use the MPI_Count typedef for their count argument. MPI_Count is defined so as to be able to hold pointer values, which makes it 64-bit long on most 64-bit systems. There are other extended calls (all end in _x) that take MPI_Count instead of int. The old MPI_Get_elements / MPI_Get_count operations are retained, but now they would return MPI_UNDEFINED if the count is larger than what the int output argument could hold (this clarification is not present in the MPI-2.2 standard and using very large counts in undefined behaviour there).

正如pyCthon所指出的那样,由于MPI论坛不再支持C ++绑定,因此在MPI-2.2中已弃用C ++绑定,并从MPI-3.0中将其删除.您应该使用C绑定,也可以求助于第三方C ++绑定,例如Boost.MPI.

As pyCthon has already noted, the C++ bindings are deprecated in MPI-2.2 and were removed from MPI-3.0 as no longer supported by the MPI Forum. You should either use the C bindings or resort to 3rd party C++ bindings, e.g. Boost.MPI.

这篇关于使用MPI :: Send可以发送的最大数据量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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