我的列表没有特别的优先顺序。该界面应:
- 仅是标头,除了
<mpi.h>
和标准库之外,没有任何依赖关系,
- 具有通用性和可扩展性
- 无阻塞只(如果你想阻止,则阻止明确,而不是由默认值),
- 允许对非阻塞操作进行基于连续的链接,
- 支持可扩展且有效的序列化(类似于Boost.Fusion,可与RMA配合使用),
- 具有零抽象损失(即至少与C接口一样快),
- 是安全的(未就绪的未来的析构函数称为?-> std :: terminate!),
- 具有
DEBUG
大量断言的强大模式,
- 非常安全的类型(没有更多的int / void *用于所有内容,我想让标签成为类型!),
- 它应该与lambda一起工作(例如,所有reduce + lambda),
- 一致地使用异常作为错误报告和错误处理机制(不再有错误代码!不再有函数输出参数!),
- MPI-IO应该以Boost.AFIO的样式提供无阻塞的I / O接口,
- 并遵循良好的现代C ++接口设计规范(定义常规类型,非成员非朋友功能,在移动语义上发挥出色,支持范围操作...)
附加功能:
我想写这样的代码:
auto buffer = some_t{no_ranks};
auto future = gather(comm, root(comm), my_offsets, buffer)
.then([&](){
/* when the gather is finished, this lambda will
execute at the root node, and perform an expensive operation
there asynchronously (compute data required for load
redistribution) whose result is broadcasted to the rest
of the communicator */
return broadcast(comm, root(comm), buffer);
}).then([&]() {
/* when broadcast is finished, this lambda executes
on all processes in the communicator, performing an expensive
operation asynchronously (redistribute the load,
maybe using non-blocking point-to-point communication) */
return do_something_with(buffer);
}).then([&](auto result) {
/* finally perform a reduction on the result to check
everything went fine */
return all_reduce(comm, root(comm), result,
[](auto acc, auto v) { return acc && v; });
}).then([&](auto result) {
/* check the result at every process */
if (result) { return; /* we are done */ }
else {
root_only([](){ write_some_error_log(); });
throw some_exception;
}
});
/* Here nothing has happened yet! */
/* ... lots and lots of unrelated code that can execute concurrently
and overlaps with communication ... */
/* When we now call future.get() we will block
on the whole chain (which might have finished by then!).
*/
future.get();
想一想如何使用MPI_C链接所有这些操作request
。您将必须通过大量不相关的代码在多个(或每个)中间步骤中进行测试,以查看是否可以不阻塞地推进链。