我的列表没有特别的优先顺序。界面应该:
- 仅是标头,没有任何依赖关系,但是
<mpi.h>
,和标准库,
- 通用且可扩展,
- 仅是非阻塞的(如果要阻塞,则显式阻塞,而不是默认阻塞),
- 允许非阻塞操作的基于延续的链接,
- 支持可扩展和高效的序列化(Boost.Fusion 之类的,这样它就可以与 RMA 一起使用),
- 具有零抽象损失(即至少与 C 接口一样快),
- 安全(调用未就绪的future的析构函数?-> std::terminate!),
- 有一个强大的
DEBUG
模式,有大量的断言,
- 非常类型安全(没有更多的 ints/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
s 链接所有这些操作。您必须通过大量不相关的代码在多个(或每个)中间步骤进行测试,以查看是否可以在不阻塞的情况下推进您的链。