2

我正在尝试使用 all_reduce 函数从每个处理器收集一个布尔值,如果任何布尔值为真(即“或”运算符),则将它们减少为真。但是我在为此找到正确的语法时遇到问题。我现在拥有的是

all_reduce(world,update,update_sum,or());

当我尝试运行它时,我得到以下编译器错误。

time_step_Gear_Verlet.cpp:94: error: expected primary-expression before '||' token
time_step_Gear_Verlet.cpp:94: error: expected primary-expression before ')' token

我尝试只使用 ||() 而不是 or(),但这也不起作用。也许我错过了什么?还是我必须采取另一种方法来做到这一点?

4

1 回答 1

4

你应该使用std::logical_or. 教程页面包含从 C MPI 到 Boost.MPI 中相应操作的操作表。

于 2012-05-07T17:37:23.930 回答