[R-sig-hpc] RhpcBLASctl: turn off restriction of BLAS/OMP threads

Scott Ritchie sritchie73 at gmail.com
Wed May 11 07:35:28 CEST 2016


Thanks Ei-ji!

On 10 May 2016 at 15:30, Ei-ji Nakama <nakama at ki.rim.or.jp> wrote:

> Hi,
>
> # save orignal threads
> old_max_threads <- omp_get_max_threads()
> old_blas_threads <- blas_get_num_procs()
>
> # Control number of threads
> omp_set_num_threads(1)
> blas_set_num_threads(1)
>
> # Work of purpose
> boofoo()
>
> # Restore the settings
> omp_set_num_threads(old_max_threads)
> blas_set_num_threads(old_blas_threads)
>
> get_num_procs is not good if operated at under the PBS(etc...)
>
> 2016-05-10 10:20 GMT+09:00 Scott Ritchie <sritchie73 at gmail.com>:
> > Hi all,
> >
> > I have written a function where I restrict the number of BLAS and OpenMP
> > threads to 1 using the functions available in the `RhpcBLASctl` package:
> >
> > ```
> > omp_set_num_threads(1)
> > blas_set_num_threads(1)
> > ```
> >
> > I would like to revert this at the end of the function so that calls to
> > BLAS from other functions/packages are unaffected by this, but I could
> not
> > find documentation on the correct way to do this.
> >
> > Is:
> >
> > ```
> > omp_set_num_threads(NULL)
> > blas_set_num_threads(NULL)
> > ```
> >
> > Correct? Or should I be setting the number of threads to the number of
> > logical processors, i.e. `get_num_procs()`?
> >
> > Thanks,
> >
> > --
> > Scott Ritchie,
> > Ph.D. Student | Integrative Systems Biology | Pathology |
> > http://www.inouyelab.org
> > The University of Melbourne
> > ---
> >
> >         [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-hpc mailing list
> > R-sig-hpc at r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-hpc
>
>
>
> --
> Best Regards,
> --
> Eiji NAKAMA <nakama (a) ki.rim.or.jp>
> "\u4e2d\u9593\u6804\u6cbb"  <nakama (a) ki.rim.or.jp>
>

	[[alternative HTML version deleted]]



More information about the R-sig-hpc mailing list