Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7297 Discussions

LAPACKE_dgeqrf hangs with omp dynamic enabled

JohhnyEnglish
Beginner
215 Views

I've been having an issue where scipy's svd hangs in mkl. My investigation seems to suggest its an issue where mkl is assuming it has 4 workers and is stuck waiting for them when it only has 1, due to me setting OMP_DYNAMIC=TRUE and omp reducing the number of workers when the machine is busy. 

 

Repro which was using the python `mkl-devel==2026.1.0` package:

#define _GNU_SOURCE

#include <mkl.h>
#include <omp.h>
#include <sched.h>
#include <stdio.h>


static double a[3000 * 128];
static double tau[128]


int main(void) {
    cpu_set_t cpus;

    /*
    We pin to one CPU to simulate OMP's behaviour when the load average on the machine is high.
    In dynamic mode this causes it to lower the maximum threading.
    */
    CPU_ZERO(&cpus);
    CPU_SET(sched_getcpu(), &cpus);
    if (sched_setaffinity(0, sizeof(cpus), &cpus) != 0) {
        perror("sched_setaffinity");
        return 1;
    }

    omp_set_dynamic(1);
    mkl_set_dynamic(0);
    mkl_set_num_threads_local(4);

    puts("starting DGEQRF");
    fflush(stdout);
    return LAPACKE_dgeqrf(LAPACK_COL_MAJOR, 3000, 128, a, 3000, tau)
}

Let me know if any more information would be useful

0 Kudos
1 Reply
Chao_Y_Intel
Moderator
107 Views

Hello,  

Could you share a bit more detail to help us reproduce this issue? Specifically: Is it on Windows or Linux? What is the command line you use to link with oneMKL? And what platform is showing this problem?

thanks,
Chao

0 Kudos
Reply