Skip to content

Choose number of OpenBLAS threads based on process affinity #1088

@carstenbauer

Description

@carstenbauer

Similar to JuliaLang/julia#42340 we should probably also consider the affinity of the Julia process when deciding how many BLAS threads we spawn by default. Currently, we don't:

➜  sca50297@cl7fr1 ~  julia --threads=auto -q
julia> using LinearAlgebra; BLAS.get_num_threads()
16

julia> Threads.nthreads()
32

julia> Sys.CPU_THREADS
32

julia>

➜  sca50297@cl7fr1 ~  taskset -c 0,1 julia --threads=auto -q
julia> using LinearAlgebra; BLAS.get_num_threads()
16

julia> Threads.nthreads()
2

In the latter case, despite the fact that our process is restricted to 2 hardware threads, we spawn 16 BLAS threads. That never seems to be a good choice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    multithreadingBase.Threads and related functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions