Opened 3 years ago

Closed 3 years ago

Last modified 11 months ago

#21323 closed defect (wontfix)

Configure OpenBLAS to be single threaded

Reported by: cpernet Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: linear algebra Keywords: BLAS, sd75
Cc: Merged in:
Authors: Reviewers: Jean-Pierre Flori, Clément Pernet
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by cpernet)

OpenBLAS is currently configured to run in multithreaded mode. This prevents a user to have control over the number of threads of his sage computation (in case he wants to split it in several processes).

Instead, I suggest to configure it with the USE_THREAD=0 option which makes it a sequential BLAS.

Note that LinBox? parallel routines (not yet exposed in SageMath) required a sequential BLAS. In turn they offer parallel speed-up of the same order, but with the option to set the number of threads as a parameters to the function called.

Change History (9)

comment:1 Changed 3 years ago by cpernet

  • Type changed from PLEASE CHANGE to defect

comment:2 Changed 3 years ago by cpernet

  • Branch set to u/cpernet/configure_openblas_to_be_single_threaded

comment:3 Changed 3 years ago by cpernet

  • Commit set to 8a863727c15b9c7e3bae02fc9cb07ef8f2ce5280
  • Description modified (diff)

New commits:

8a86372add USE_THREAD=0 argument to OpenBLAS configure

comment:4 Changed 3 years ago by git

  • Commit changed from 8a863727c15b9c7e3bae02fc9cb07ef8f2ce5280 to 85f25f68f6a8783a5c2f158009928b9d0fcec450

Branch pushed to git repo; I updated commit sha1. New commits:

85f25f6revert the order of arguments: so as to let user the opportunity to override it.

comment:5 Changed 3 years ago by cpernet

  • Authors set to Clément Pernet
  • Status changed from new to needs_review

comment:6 Changed 3 years ago by jpflori

  • Reviewers set to Jean-Pierre Flori
  • Status changed from needs_review to needs_info

I see in OpenBLAS doc (https://github.com/xianyi/OpenBLAS/wiki/faq):

    How can I use OpenBLAS in multi-threaded applications?

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.
*    export OPENBLAS_NUM_THREADS=1 in the environment variables. Or
*    Call openblas_set_num_threads(1) in the application on runtime. Or
*    Build OpenBLAS single thread version, e.g. make USE_THREAD=0

So it seems we could disable mt at runtime. Any thought abour this?

comment:7 Changed 3 years ago by cpernet

  • Authors Clément Pernet deleted
  • Branch u/cpernet/configure_openblas_to_be_single_threaded deleted
  • Commit 85f25f68f6a8783a5c2f158009928b9d0fcec450 deleted
  • Milestone changed from sage-7.4 to sage-duplicate/invalid/wontfix
  • Reviewers changed from Jean-Pierre Flori to Jean-Pierre Flori, Clément Pernet
  • Status changed from needs_info to positive_review

Right. After thinking this through, we figured that the best option is to have fflas-ffpack call the openblas_set_num_threads(1) before each call to OpenBLAS.

This ticket therefore becomes https://github.com/linbox-team/fflas-ffpack/issues/42

comment:8 Changed 3 years ago by embray

  • Resolution set to wontfix
  • Status changed from positive_review to closed

Determined to be invalid/duplicate/wontfix (closing as "wontfix" as a catch-all resolution).

comment:9 Changed 11 months ago by saraedum

See #26118 for a related issue.

Note: See TracTickets for help on using tickets.