Opened 12 years ago

Last modified 9 years ago

#5292 new Patches

boost::mpi::scatterv and boost::mpi::gatherv added

Reported by: Júlio Hoffimann <julio.hoffimann@…> Owned by: Matthias Troyer
Milestone: To Be Determined Component: mpi
Version: Boost 1.45.0 Severity: Not Applicable
Keywords: collective operations Cc: troyer@…

Description

Two more collective operations for Boost.MPI. I made the headers completely based on the existent one: scatter.hpp and gather.hpp

"common use versions" was added too, for those cases where the great buffer is stored contiguously at the root process.

The "common use version" of gatherv needs a warning in the docs: Since the process send it's own buffer size and nothing more, all sizes will be gathered before the real call. I don't know if this is tolerable, you have the decision.

Other doubt about gatherv implementation: I did switch to the packed_archive_send() / packed_archive_recv() communication, i tried to figure out the difference in send an archive or send using communicator::send when dealing with non-MPI types, but without success. boost::mpi::scatter uses the first and boost::mpi::gather uses the second. Anyway,the snippet of code is commented if you want to switch back.

I'm sending a Main.cpp file with the simple tests i made, comment or uncomment the prototypes in pairs: scatterv / gatherv.

To see the results in a separate terminal for each process, this is a possible way:

mpicxx Main.cpp -o test && echo 107 > input.txt && mpirun -np 4 xterm -e ./test

Attachments (9)

scatterv.hpp (5.7 KB ) - added by Júlio Hoffimann <julio.hoffimann@…> 12 years ago.
gatherv.hpp (5.4 KB ) - added by Júlio Hoffimann <julio.hoffimann@…> 12 years ago.
Main.cpp (4.7 KB ) - added by Júlio Hoffimann <julio.hoffimann@…> 12 years ago.
scatterv(fixed version).hpp (5.6 KB ) - added by Júlio Hoffimann <julio.hoffimann@…> 12 years ago.
Fixed version
gatherv(fixed version).hpp (5.6 KB ) - added by Júlio Hoffimann <julio.hoffimann@…> 12 years ago.
Fixed version
Main(fixed version).cpp (5.3 KB ) - added by Júlio Hoffimann <julio.hoffimann@…> 12 years ago.
Fixed version
gatherv(fixed version 2).hpp (5.6 KB ) - added by Júlio Hoffimann <julio.hoffimann@…> 12 years ago.
Fixed version 2
gatherv(fixed version 3).hpp (5.6 KB ) - added by Júlio Hoffimann <julio.hoffimann@…> 12 years ago.
Fixed version 3
Main(fixed version 2).cpp (5.3 KB ) - added by Júlio Hoffimann <julio.hoffimann@…> 12 years ago.
Fixed version 2

Download all attachments as: .zip

Change History (14)

by Júlio Hoffimann <julio.hoffimann@…>, 12 years ago

Attachment: scatterv.hpp added

by Júlio Hoffimann <julio.hoffimann@…>, 12 years ago

Attachment: gatherv.hpp added

by Júlio Hoffimann <julio.hoffimann@…>, 12 years ago

Attachment: Main.cpp added

by Júlio Hoffimann <julio.hoffimann@…>, 12 years ago

Attachment: scatterv(fixed version).hpp added

Fixed version

by Júlio Hoffimann <julio.hoffimann@…>, 12 years ago

Attachment: gatherv(fixed version).hpp added

Fixed version

by Júlio Hoffimann <julio.hoffimann@…>, 12 years ago

Attachment: Main(fixed version).cpp added

Fixed version

by Júlio Hoffimann <julio.hoffimann@…>, 12 years ago

Fixed version 2

by Júlio Hoffimann <julio.hoffimann@…>, 12 years ago

Fixed version 3

by Júlio Hoffimann <julio.hoffimann@…>, 12 years ago

Attachment: Main(fixed version 2).cpp added

Fixed version 2

comment:1 by Júlio Hoffimann <julio.hoffimann@…>, 12 years ago

Thinking better... the gatherv prototype that calls gather is not great. Was discarded and the user needs to pass all sizes.

comment:2 by Júlio Hoffimann <julio.hoffimann@…>, 12 years ago

I don't understand so much about copyright terms, be free to remove my name in the header files. :-)

Júlio.

comment:3 by Júlio Hoffimann <julio.hoffimann@…>, 11 years ago

Type: Feature RequestsPatches

comment:4 by Matthias Troyer, 10 years ago

Owner: changed from Douglas Gregor to Matthias Troyer

comment:5 by dkushner2@…, 9 years ago

Can we receive an update on this, please? Seems like an excellent and much-needed addition to the present implementation. As it stands, the Boost implementation of scatter is all but useless (i.e. no support for count-array and thus no ability to scatter a vector that is greater than the comm size).

Note: See TracTickets for help on using tickets.