Question

I am trying to use the all_reduce function to collect a boolean from each processor and reduce them to true if any of the booleans are true(ie the "or" operator). But I am having issues finding the right syntax for this. What I have right now is

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

I get the following compiler errors when I try to run this.

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

I tried just using ||() instead of or(), but that doesn't work either. Maybe I'm missing something? Or is there another way I have to go about doing this?

Was it helpful?

Solution

You should use std::logical_or. The tutorial page has tables of operations from C MPI to their corresponding operations in Boost.MPI.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top