Search code examples
multithreadingeigenarmadillointel-mklaccelerate-framework

Multithreaded MKL and Eigen


I need to use a parallel linear algebra on OSX and as painlessly as possible (i.e., at most I can use HomeBrew with my colleagues) factorization library due to the number of DOFs I have in my problems.

I've tried Armadillo, it supports sparse algebra which is what I need, I can link with the Accelerate framework, but it just solves linear problems, it doesn't support factorization AFAIK.

Next, MKL, but nothing I can do seems to trigger threading, even with TBB:

tbb::task_scheduler_init scheduler(4);
mkl_set_dynamic(true);
mkl_set_num_threads(4);
mkl_set_num_threads_local(4);

Eigen could be cool, but it seems that, like MKL, it won't run in parallel.

Do you have any suggestions?


Solution

  • OSX clang does not support openmp, which is required by multi-thread Eigen and MKL.

    According to Intel® Math Kernel Library Link Line Advisor, MKL does not support TBB threading with clang.

    But it seems to support Intel OpenMP library with the extra link option -liomp5. You could try if it works. If not, you may have to use another compiler such as gcc. You could find it in HomeBrew.