|
Boost Users : |
Subject: [Boost-users] mpi skeleton/content does not work with stl complex
From: Tobias Stollenwerk (tobias.stollenwerk_at_[hidden])
Date: 2011-04-27 17:57:54
Hello all,
It seems that sending stl complex data via the skeleton/content
mechanism does not work. Here is a simple code that shows th problem:
#include <boost/mpi.hpp>
#include <boost/serialization/complex.hpp>
#include <boost/serialization/vector.hpp>
#include <iostream>
namespace mpi = boost::mpi;
using namespace std;
int main(int argc, char* argv[])
{
mpi::environment env(argc, argv);
mpi::communicator world;
int NN=world.size();
int myid=world.rank();
if (myid == 0)
{
int N = 10;
vector <complex<double> > l(N);
for (int p=1; p!=NN; p++)
{
int taskid=1;
world.send(p, 0, taskid);
world.send(p, 1, mpi::skeleton(l));
}
mpi::content c = mpi::get_content(l);
for (int n = 0; n!=l.size() ; n++)
{
l[n]=complex<double>(1.0,1.0);
}
for (int p=1; p!=NN; p++)
{
world.send(p, 1, c);
}
}
else
{
vector <complex<double> > l;
mpi::content c;
world.recv(0, 1, mpi::skeleton(l));
c = mpi::get_content(l);
world.recv(0, 1, c);
for (int n=0; n!=l.size(); n++)
{
cout << l[n] << " ";
}
cout << endl;
}
}
The entries of the vector l are not (1.0,1.0) but they seem to be
uninitialized. This only occurs if one uses complex data types AND
the skeleton/content mechanism.
Does anyone know, if this is a build
in problem, or if I am doing something wrong?
Thanks in advance,
Tobias
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net