Boost logo

Ublas :

Subject: [ublas] ublas types with OpenMP
From: Kraus Philipp (philipp.kraus_at_[hidden])
Date: 2011-11-25 08:38:23


Hello,

I try to create threads with OpenMP:

ublas::matrix<T> l_matrix( rows, cols );

#pragma omp parallel for shared(l_matrix)
for(std::size_t n=0; n < l_matrix.size1(); ++n)
        ublas::row(l_matrix, n) = <set a vector>

is this a problem with the ublas data structures something like
shared access to the elements or anything else?

Should I transform the the loop to:

#pragma omp parallel for shared(l_matrix)
for(std::size_t n=0; n < l_matrix.size1(); ++n)
        #pragma omp critical
        ublas::row(l_matrix, n) = <set a vector>

Thanks

Phil