Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OPENBLAS_DEFAULT_NUM_THREADS #3773

Merged

Conversation

staticfloat
Copy link
Contributor

This allows Julia to set a default number of threads (usually 1) to be used when no other thread counts are specified [0], to short-circuit the default OpenBLAS thread initialization routine that spins up a different number of threads than Julia would otherwise choose.

The reason to add a new environment variable is that we want to be able to configure OpenBLAS to avoid performing its initial memory allocation/thread startup, as that can consume significant amounts of memory, but we still want to be sensitive to legacy codebases that set things like OMP_NUM_THREADS or GOTOBLAS_NUM_THREADS. Creating a new environment variable that is openblas-specific and is not already publicly used to control the overall number of threads of programs like Julia seems to be the best way forward.

[0] JuliaLang/julia#46844

@staticfloat staticfloat force-pushed the sf/openblas_default_num_threads branch 2 times, most recently from 446cae2 to 8969146 Compare September 29, 2022 22:27
This allows Julia to set a default number of threads (usually `1`) to be
used when no other thread counts are specified [0], to short-circuit the
default OpenBLAS thread initialization routine that spins up a different
number of threads than Julia would otherwise choose.

The reason to add a new environment variable is that we want to be able
to configure OpenBLAS to avoid performing its initial memory
allocation/thread startup, as that can consume significant amounts of
memory, but we still want to be sensitive to legacy codebases that set
things like `OMP_NUM_THREADS` or `GOTOBLAS_NUM_THREADS`.  Creating a new
environment variable that is openblas-specific and is not already
publicly used to control the overall number of threads of programs like
Julia seems to be the best way forward.

[0] JuliaLang/julia#46844
@staticfloat staticfloat force-pushed the sf/openblas_default_num_threads branch from 8969146 to d2ce931 Compare September 30, 2022 01:21
@martin-frbg
Copy link
Collaborator

Sorry for the delay here - I guess it would be nicer if the existing OPENBLAS_NUM_THREADS could be reworked to act the same with both pthreads and OpenMP, but a way to limit the thread count for just this library rather than the entire process does certainly make sense in any case.

@martin-frbg martin-frbg added this to the 0.3.22 milestone Oct 13, 2022
@martin-frbg martin-frbg merged commit ab6009b into OpenMathLib:develop Oct 13, 2022
KristofferC added a commit to JuliaLang/julia that referenced this pull request Dec 31, 2022
This was add to OpenBLAS in OpenMathLib/OpenBLAS#3773 and was supposed to be used in #46844 but was likely typod
KristofferC added a commit to JuliaLang/julia that referenced this pull request Jan 1, 2023
…#48064)

This was add to OpenBLAS in OpenMathLib/OpenBLAS#3773 and was supposed to be used in #46844 but was likely typod
KristofferC added a commit to JuliaLang/julia that referenced this pull request Jan 2, 2023
…#48064)

This was add to OpenBLAS in OpenMathLib/OpenBLAS#3773 and was supposed to be used in #46844 but was likely typod

(cherry picked from commit 75bc5ee)
KristofferC added a commit to JuliaLang/julia that referenced this pull request Jan 2, 2023
…#48064)

This was add to OpenBLAS in OpenMathLib/OpenBLAS#3773 and was supposed to be used in #46844 but was likely typod

(cherry picked from commit 75bc5ee)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants