Subject: Re: [ublas] thread safety of matrix multiplication
From: Gunter Winkler (guwi17_at_[hidden])
Date: 2009-11-25 15:36:28
Am Wednesday 25 November 2009 schrieb James C. Sutherland:
> If I have a ublas matrix object, is it thread safe w.r.t. matvec
> operations? In other words:
> typedef boost::numeric::ublas::compressed_matrix< double,
> boost::numeric::ublas::row_major > MatType;
> MatType mat; // both threads use the same matrix object.
> VecType a1, b1, a2, b2;
> // ... assemble matrix and vectors ...
> // ...
> // thread 1 code:
> axpy_prod( mat, a1, b1, true );
> // thread2 code:
> axpy_prod( mat, a2, b2, true );
> Should this be thread safe? My observation is that it is NOT. I am
> getting memory corruption somewhere.
This is quite strange because axpy_prod only reads from the matrix and
a1. The only write access is to b1. Can you try to build a small test
program that shows the memory corruption?
> Also, it seems that axpy_prod is no longer included in the boost
> documentation (html) - is that function being deprecated in favor of
> the prod(...) functions?
axpy_prod is mentioned here:
However I agree, that the operations.hpp needs more documentation.