Skip to content

Multithreaded OpenBLAS heuristics #1028

@PallHaraldsson

Description

@PallHaraldsson

In the docs:

When you start Julia in multithreaded mode, i.e. julia -tX or JULIA_NUM_THREADS=X, it is generally recommended to set OPENBLAS_NUM_THREADS=1 or, equivalently, BLAS.set_num_threads(1).

That's a heuristic, likely not always right, but I suggest either:

  1. If this is true, then do it automatically for the user, and have a way to get the old number of threads that the current implementation would have given.
  2. It's plausible it works better, because the other threads are simply busy doing other non-BLAS work. Is there a good middle-ground then, use half as many threads?
  3. It's also plausible that the recommendation simply makes things slower, the other threads could be doing no work even, then we have a dilemma. I'm not sure but are calls to OpenBLAS serialized? It seems they should be and would that also help, and then not have to change any settings, or adjust less, for multi-threaded?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions