|
Boost Users : |
Subject: [Boost-users] [multiindex] Ordered index corruption
From: Chris Jewell (chris.jewell_at_[hidden])
Date: 2011-07-21 09:55:49
Hi All,
I have a problem with a multiindex ordered_non_unique index becoming corrupted :(
I am working with a multiindex that stores class objects of type Individual:
class Individual
{
double I_;
double id_;
public:
double getId() const;
double getI() const;
void setId(const std::string id);
void setI(const double I);
}
boost::multi_index_container<
Individual,
indexed_by<
random_access< tag<bySeq> >,
hashed_unique< tag<byId>, const_mem_fun<Individual,string,&Individual::getId> >,
ordered_non_unique<tag<byI>, const_mem_fun<Individual,double,&Individual::getI> >
>
>
I have an algorithm that works on these data, using Individual::I to calculate a summary value across the whole dataset. An Individual i is then chosen at random, and i.I updated using the multiindex::modify method with a functor:
struct modifyI
{
modifyI(double newI) : newI_(newI) {}
void operator()(Individual& i)
{
i.setI(newI_);
}
private:
double newI_;
};
This calculation is then repeated many times. The actual calculation is done in parallel using MPI (Boost::MPI on top of OpenMPI), with the final reduction being broadcast to all processes. This enables each processor to make the same change to its copy of the multiindex. In *theory* this should mean that each process has a complete replicate of the multiindex.
However, I am finding that the ordered_non_unique index is becoming corrupted in that the ordering (strict less than on Individual::I) gets messed up for a few (c. 2 or 3) of the elements. Essentially, it appears that small blocks of the index get swapped round. This is not occurring simultaneously on all processes, which is odd because the same multiindex::modify method is called for each process with the same arguments.
Can anyone suggest a way I can move forward on trying to debug this?
Thanks,
Chris
-- Dr Chris Jewell Department of Statistics University of Warwick Coventry CV4 7AL UK Tel: +44 (0)24 7615 0778
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