Boost logo

Ublas :

From: Georg Baum (Georg.Baum_at_[hidden])
Date: 2007-09-25 02:51:36


Am Dienstag 25 September 2007 08:28 schrieb Riccardo Rossi:
> Hi Sarah,
> i have little experience with OpenMP nevertheless i am really interested
> in the subject.
>
> there are two things in your code that i find a little strange:
>
> 1 - you do "um.clear();" before pushing back... i guess with this you
> may be breaking the memory as you will be adding a 0*0 matrix while
> later you may suppose it is different from zero.

This is not a problem (at least not in the example code), since she later
assigns a new matrix to um. In fact, the whole loop

> > for (unsigned i = 0; i < 4; ++i)
> >
> > {
> >
> > ublas::matrix<double> um(n1, n2);
> >
> > um.clear();
> >
> > outputVec.push_back(um);
> >
> > }

is uneeded, one would get the same result with the single statement

std::vector< ublas::matrix<double> > outputVec(4);

> > The whole parallelization scheme is perfectly stable if std::vector
> > based matrix is used rather than ublas, which is considerably slower
> > than ublas.

What exactly does stable/unstable mean? Please post a minimal compilable
example and explain exactly what happens in parallel builds and in
sequential ones. Then it will probably be easy to help.

Georg