MAGMA  1.5.0
Matrix Algebra for GPU and Multicore Architectures
 All Files Functions Groups
Utilities


More...

Functions

magma_int_t magma_get_parallel_numthreads ()
 Returns the number of threads to use for parallel sections of MAGMA. More...
 
magma_int_t magma_get_lapack_numthreads ()
 

Purpose

Returns the number of threads currently used for LAPACK and BLAS. More...
 
void magma_set_lapack_numthreads (magma_int_t threads)
 

Purpose

Sets the number of threads to use for LAPACK and BLAS. More...
 

Detailed Description


Function Documentation

magma_int_t magma_get_lapack_numthreads ( )

Purpose

Returns the number of threads currently used for LAPACK and BLAS.

Typically, the number of threads is initially set by the environment variables OMP_NUM_THREADS or MKL_NUM_THREADS.

If MAGMA is compiled with MAGMA_WITH_MKL, this queries MKL; else if MAGMA is compiled with OpenMP, this queries OpenMP; else this returns 1.

See Also
magma_get_parallel_numthreads
magma_set_lapack_numthreads
magma_int_t magma_get_parallel_numthreads ( )

Returns the number of threads to use for parallel sections of MAGMA.

Typically, it is initially set by the environment variables OMP_NUM_THREADS or MAGMA_NUM_THREADS.

If MAGMA_NUM_THREADS is set, this returns min( num_cores, MAGMA_NUM_THREADS ); else if MAGMA is compiled with OpenMP, this queries OpenMP and returns min( num_cores, OMP_NUM_THREADS ); else this returns num_cores.

For the number of cores, if MAGMA is compiled with hwloc, this queries hwloc; else it queries sysconf (on Unix) or GetSystemInfo (on Windows).

See Also
magma_get_lapack_numthreads
magma_set_lapack_numthreads
void magma_set_lapack_numthreads ( magma_int_t  threads)

Purpose

Sets the number of threads to use for LAPACK and BLAS.

Internal routines.

This is often used to set BLAS to be single-threaded during sections where MAGMA uses explicit pthread parallelism. Example use:

nthread_save = magma_get_lapack_numthreads();
magma_set_lapack_numthreads( 1 );

... launch pthreads, do work, terminate pthreads ...

magma_set_lapack_numthreads( nthread_save );

If MAGMA is compiled with MAGMA_WITH_MKL, this sets MKL threads; else if MAGMA is compiled with OpenMP, this sets OpenMP threads; else this does nothing.

Parameters
[in]threadsINTEGER Number of threads to use. threads >= 1. If threads < 1, this silently does nothing.
See Also
magma_get_parallel_numthreads
magma_get_lapack_numthreads