OpenMathLib / OpenMathLib/OpenBLAS

Could you elaborate on the combination of OpenBLAS with multi-threading?

Open
#2,543 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Documentation
Dominant language
C
Stars
7.6k
Forks
1.7k
Avg merge
1d 3h
Merged PRs (30d)
42

Description

https://github.com/xianyi/OpenBLAS/wiki/Faq/4bded95e8dc8aadc70ce65267d1093ca7bdefc4c#multi-threaded says:

If your application is already multi-threaded, it will conflict with OpenBLAS multi-threading. Thus, you must set OpenBLAS to use single thread as following ...

That is good to know, but it is very unspecific.

To aid people debugging problems, could you elaborate a bit on that? What does "will conflict" mean exactly here? How do things break? What are the fundamental technical reasons?


Also, many Linux distributions ship OpenBLAS with OpenMP enabled. And then bindings from other, programming languages that have their own built-in threading which is not based on OpenMP (Haskell, Go, etc) use the distribution-provided packages, often without setting OPENBLAS_NUM_THREADS=1 or openblas_set_num_threads(1).

In my understanding, this violates what's stated in https://github.com/xianyi/OpenBLAS/wiki/faq#multi-threaded and is thus unsafe. Can you, as a general guideline, confirm whether languages with built-in threading must address this?

Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked OpenBLAS Wiki FAQ and its Multi-threaded section, then review the linked Multi-threaded page and the references to OPENBLAS_NUM_THREADS and openblas_set_num_threads(1). Document what “conflict” means, why it can occur, and whether applications using Go, Haskell, or other runtimes need guidance. Done means the FAQ gives concrete failure modes and a clear general recommendation.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, go, haskell
Domain
documentation, performance
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.