The MKL_DIRECT_CALL macros expand to something like
if(.....){ ....... }else{ static MKL_INT mkl_direct_call_flag = 0 zgemm_direct((transa), (transb), (m), (n), (k), (alpha), (a), (lda), (b), (ldb), (beta), (c), (ldc), &mkl_direct_call_flag); }
The static variable is initialized the FIRST time the block is entered, so its not thread-safe.