Registered Member
|
Dear experts, I got a problem. When I turn on mp, I get the error
eigen_assert((p<=startId || m_data.index(p-1)!=inner) && "you cannot insert an element that already exists, you must call coeffRef to this end"); m_innerNonZeros[outer]++;
If I take out #pragma omp parallel for , the code can work well, why? |
Registered Member
|
maybe, coeffRef should be used on an existed element.
PS. with OpenMP directive, the Matrix should be independent with each other, or threads conflict may happen. |
Moderator
|
SparseMatrix::coeffRef is more like std::vector::push_back in the context of multi-threading. So you either have to protect the call with a omp critical section (very costly), or better make sure you allocate enough room for each column using SparseMatrix::reserve(some_vector_of_integers) and then making sure that each column is filled by only one thread.
|
Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient