[petsc-users] prevent linking to multithreaded BLAS?

Barry Smith bsmith at petsc.dev
Wed Dec 7 15:33:37 CST 2022


  We don't have configure code to detect if the BLAS is thread parallel, nor do we have code to tell it not to use a thread parallel version. 

  Except if it is using MKL then we do force it to not use the threaded BLAS.

  A "cheat" would be for you to just set the environmental variable BLAS uses for number of threads to 1 always, then you would not need to worry about checking to avoid the "bad" library.

  Barry




> On Dec 7, 2022, at 4:21 PM, Mark Lohry <mlohry at gmail.com> wrote:
> 
> I ran into an unexpected issue -- on an NP-core machine, each MPI rank of my application was launching NP threads, such that when running with multiple ranks the machine was quickly oversubscribed and performance tanked.
> 
> The root cause of this was petsc linking against the system-provided library (libopenblas0-pthread in this case) set by the update-alternatives in ubuntu. At some point this machine got updated to using the threaded blas implementation instead of serial; not sure how, and I wouldn't have noticed if I weren't running interactively.
> 
> Is there any mechanism in petsc or its build system to prevent linking against an inappropriate BLAS, or do I need to be diligent about manually setting the BLAS library in the configuration stage?
> 
> Thanks,
> Mark



More information about the petsc-users mailing list