[Trilinos-Users] Teuchos::reduceAllAndScatter issue?

Baker, Christopher G. bakercg at ornl.gov
Wed Aug 25 06:49:38 MDT 2010


Nico, I think you want Teuchos::reduceAll(). reduceAllAndScatter() wraps the MPI_REDUCE_SCATTER method, which (according to what I understood of the documentation I just read) will perform a number of reductions (according to recvcounts) and scatter the result of a subset of these reductions (according to recvcounts). So the input that you are sending is not correct for the method; the sum of the recvCounts yields N (== number of procs), while the number of inputs is only one. In fact, in a debug build, the code causes Teuchos to throw an exception for the invalid data.

I have modified your code and reattached to show appropriate use of reduceAll() and redueAllAndScatter().

Best regards,
Chris


On 8/24/10 10:54 PM, "Nico Schlömer" <nico.schloemer at ua.ac.be> wrote:

Hi all,

I just played around with Teuchos::reduceAllAndScatter and I can't
seem to get it to work. The data would be reduced correctly, but the
buffers of all processes except 0 are filled with garbage; process 0
has the correct result.

A minimal example of what I did is attached. When running on four
cores, I get

================= *snip* =================
Sum on process 0: 4
Sum on process 1: 2.7657e-309
Sum on process 3: 6.52167e-322
Sum on process 2: 6.32404e-322
================= *snap* =================

Any obvious mistakes?

Cheers,
Nico

-------------- next part --------------
A non-text attachment was scrubbed...
Name: nico_comm.cpp
Type: video/x-fl
Size: 1636 bytes
Desc: nico_comm.cpp
Url : https://software.sandia.gov/pipermail/trilinos-users/attachments/20100825/b3efd207/attachment.bin 


More information about the Trilinos-Users mailing list