Simplify num_cpu_avail() syntax#5907
Conversation
…ixes OpenMathLib#5806. Until now, the code in `num_cpu_avail()`, if (blas_cpu_number != openmp_nthreads) { goto_set_num_threads(openmp_nthreads); } would just always set the threads back to OpenMP's thread count.
|
@martin-frbg answering your #5808 (comment)
I added back 1 line I had originally removed, which simplifies the review. The change is purely syntactical (beyond relying on For review convenience: Step-by-step equivalence for
|
|
@nh2 https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2023-0/mkl-set-num-threads-local.html is I think the intent (not the reality) of what This would be extremely useful; I expect to write an article about why soon, but the short version is that if user code is creating its own threads, only having a process-wide setting is very frustrating. |
58f0951 to
2cd33e8
Compare
|
@itamarst Ah, OK. Well, th function really doesn't do any of that, not using thread-local variables at all. I updated the comment with a write-up of that, so that outside contributors or users at least have an idea of what's going on. |
openblas_set_num_threads()#5808, merge that first.openblas_set_num_threads()#5808 (comment)