mirror of
https://github.com/amd/blis.git
synced 2026-05-11 01:30:00 +00:00
Added missing bli_init_once() in bli_thread API.
Details: - Fixed an issue with specifying threading globally at runtime via bli_thread_set_num_threads() (the automatic way) or via bli_thread_set_ways() (the manual way), with bli_thread_init_rntm() also affected. These functions were not calling bli_init_once() prior to acting, and therefore their effects on the global rntm_t structure were being wiped out by the eventual call to bli_init_once(), by some other BLIS function. Thanks to Ali Emre Gülcü for reporting the behavior associated with this bug. - Added additional content to docs/Multithreading.md covering topics of choosing between OpenMP and pthreads, and specifying affinity via OpenMP. - CREDITS file update.
This commit is contained in:
@@ -1303,6 +1303,9 @@ static bli_pthread_mutex_t global_rntm_mutex = BLIS_PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
void bli_thread_set_ways( dim_t jc, dim_t pc, dim_t ic, dim_t jr, dim_t ir )
|
||||
{
|
||||
// We must ensure that global_rntm has been initialized.
|
||||
bli_init_once();
|
||||
|
||||
// Acquire the mutex protecting global_rntm.
|
||||
bli_pthread_mutex_lock( &global_rntm_mutex );
|
||||
|
||||
@@ -1314,6 +1317,9 @@ void bli_thread_set_ways( dim_t jc, dim_t pc, dim_t ic, dim_t jr, dim_t ir )
|
||||
|
||||
void bli_thread_set_num_threads( dim_t n_threads )
|
||||
{
|
||||
// We must ensure that global_rntm has been initialized.
|
||||
bli_init_once();
|
||||
|
||||
// Acquire the mutex protecting global_rntm.
|
||||
bli_pthread_mutex_lock( &global_rntm_mutex );
|
||||
|
||||
@@ -1327,6 +1333,9 @@ void bli_thread_set_num_threads( dim_t n_threads )
|
||||
|
||||
void bli_thread_init_rntm( rntm_t* rntm )
|
||||
{
|
||||
// We must ensure that global_rntm has been initialized.
|
||||
bli_init_once();
|
||||
|
||||
// Acquire the mutex protecting global_rntm.
|
||||
bli_pthread_mutex_lock( &global_rntm_mutex );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user