Is armadillo solve() thread safe?

前端 未结 2 722
清歌不尽
清歌不尽 2021-02-06 20:04

In my code I have loop in which I construct and over determined linear system and try to solve it:

#pragma omp parallel for
for (int i = 0; i < n[0]+1; i++) {         


        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-06 20:29

    The thread safety of Armadillo's solve() function depends (only) on the BLAS library that you use. The LAPACK implementations are thread safe when BLAS is. The Armadillo solve() function is not thread safe when linking to the reference BLAS library. However, it is thread safe when using OpenBLAS. Additionally, ATLAS provides a BLAS implementation that also mentions it is thread safe, and the Intel MKL is thread safe as well, but I have no experience with Armadillo linked to those libraries.

    Of course, this only applies when you run solve() from multiple threads with different data.

提交回复
热议问题