Fix OMP nesting problem.

Detect when OpenMP uses fewer threads than requested and correct accordingly, so that we don't wait forever for nonexistent threads. Fixes #267.
This commit is contained in:
Devin Matthews
2018-10-11 10:45:07 -05:00
committed by GitHub
parent 53a9ab1c85
commit 6ac0c80560

View File

@@ -230,7 +230,18 @@ void bli_l3_thread_decorator
_Pragma( "omp parallel num_threads(n_threads)" )
{
dim_t n_threads_real = omp_get_num_threads();
dim_t id = omp_get_thread_num();
if ( n_threads_real != n_threads )
{
if ( id == 0 )
{
n_threads = n_threads_real;
bli_thrcomm_init( gl_comm, n_threads );
}
_Pragma( "omp barrier" )
}
obj_t a_t, b_t, c_t;
cntl_t* cntl_use;