Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2007-09-24 19:31:25


Am Montag, 24. September 2007 16:02 schrieb Tan, Sarah (FID):
> I am wondering whether anyone has experience with the stability issue
> when compiling ublas with Intel C++ Compiler for Windows (ICC 9.1).

I don't have experience with OpenMP, yet, but debugging parallel code is
always challenging. Can you please open an issue via

http://svn.boost.org/trac/boost/newticket

and attach a running sample program that exactly produces the strange
behavior? Without example I cannot do anything.

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

Can you check that you have 4 independent instances stored in outputVec?

>
> #pragma omp parallel
>
> {
>
> #pragma omp sections
>
> {
>
> #pragma omp section
>
> { outputVec[0] = doSomething();}
>
> #pragma omp section
>
> { outputVec[1] = doSomething();}
>
> #pragma omp section
>
> { outputVec[2] = doSomething();}
>
> #pragma omp section
>
> { outputVec[3] = doSomething();}
>
> }

do these doSomething() methods reallocate data? I don't know how
matrix.assign_temporary behaves in parallel mode ...

> #pragma omp barrier
>

can you check how the individual matrices look like?

> for (unsigned i = 0; i < 4; ++i)
>
> output += outputVec[i];

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

Maybe ublas does some 'optimizations' that are not thread safe. We have
to check this.

mfg
Gunter