You should call vector.reserve(n) before you call recv and benchmark again because otherwise you are timing a memory allocation in the vector benchmarks that isn't there in the array benchmarks.

Bests, 
Gonzalo



On Mon, Jan 20, 2014 at 3:24 PM, Simon Etter <ettersi@student.ethz.ch> wrote:
Hi!

When benchmarking the performance of sending a std::vector<double> with Boost.MPI, I noticed that you can gain several factors of speedup if you replace

std::vector<double> data(n);
comm.send(0,0,data);

by e.g.

std::vector<double> data(n);
comm.send(0,0, boost::mpi::skeleton(data));
comm.send(0,0, boost::mpi::get_content(data));

The code to benchmark, the measured data as well as a plot thereof are attached. Further parameters were:

MPI implementation: Open MPI 1.6.5
C++ compiler: gcc 4.8.2
Compiler flags: -O3 -std=c++11
mpirun parameter: --bind-to-core
CPU model: AMD Opteron(tm) Processor 6174

Why is it/what am I doing wrong that the default sending of std::vector<double> performs so badly?

Best regards,
Simon Etter

_______________________________________________
Boost-mpi mailing list
Boost-mpi@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-mpi




--
Dipl.-Ing. Gonzalo Brito Gadeschi
Institute of Aerodynamics and Chair of Fluid Mechanics
RWTH Aachen University
Wuellnerstraße 5a
D-52062 Aachen
Germany
Phone: ++49-(0)241-80-94821
Fax: ++49-(0)241-80-92257
E-mail:  g.brito@aia.rwth-aachen.de
Internet: www.aia.rwth-aachen.de