![]() |
MAGMA 2.9.0
Matrix Algebra for GPU and Multicore Architectures
|
Classes | |
class | magma_task |
Super class for tasks used with magma_thread_queue. More... | |
class | magma_thread_queue |
TODO: replace with OpenMP tasks. More... | |
Functions | |
magma_int_t | magma_get_parallel_numthreads () |
magma_int_t | magma_get_lapack_numthreads () |
void | magma_set_lapack_numthreads (magma_int_t threads) |
Sets the number of threads to use for LAPACK and BLAS. | |
magma_int_t | magma_get_omp_numthreads () |
void | magma_set_omp_numthreads (magma_int_t threads) |
Sets the number of threads to use for parallel section. | |
magma_int_t | magma_yield () |
Yield the CPU to let another thread of lower priority run, for example, for I/O. | |
magma_int_t magma_get_parallel_numthreads | ( | ) |
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).
magma_int_t magma_get_lapack_numthreads | ( | ) |
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.
void magma_set_lapack_numthreads | ( | magma_int_t | threads | ) |
Sets the number of threads to use for LAPACK and BLAS.
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.
[in] | threads | INTEGER Number of threads to use. threads >= 1. If threads < 1, this silently does nothing. |
magma_int_t magma_get_omp_numthreads | ( | ) |
void magma_set_omp_numthreads | ( | magma_int_t | threads | ) |
Sets the number of threads to use for parallel section.
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_omp_numthreads(); magma_set_omp_numthreads( 1 ); ... launch pthreads, do work, terminate pthreads ... magma_set_omp_numthreads( nthread_save );
[in] | threads | INTEGER Number of threads to use. threads >= 1. If threads < 1, this silently does nothing. |