JohnLeM
JohnLeM

Reputation: 51

Module not found error while compiling MKL library with Visual Studio 2019 and windows 10

I am facing a strange behavior of Visual Studio 2019 (v 16.5.4) while producing a python module linked against Intel MKL libraries (2020 Update 1). Any help would be appreciated !

To reproduce it : create a small python module "Project1.pyd" using VS2019 with the following lines

#include <pybind11/pybind11.h>
#include <mkl.h>

void test() {
    const MKL_INT m(10);
    double test[m*m];
    cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, m, m, m, 1., test, m, test, m, 0., test, m);
}

PYBIND11_MODULE(Project1, m) {
    m.def("test", &test);
}

This code is linked against mkl_rt.lib as added library dependancy to get cblas_dgemm defined. Then I call the module with the simple python line

if __name__ == "__main__":
import Project1 as p

leading to 'DLL load failed: Module not found'

Note that I was able to run the same code using VS2019 16.4.5 / Python 3.6.

The awful thing is that the compiler or the linker does not complain about anything : I spent three full days to identify and isolate this problem as it arised in a big C++ / python library.

Upvotes: 2

Views: 1612

Answers (1)

JohnLeM
JohnLeM

Reputation: 51

Problem solved using stijn and Evg suggestions :

1) The issue was characterized using Dependency (github.com/lucasg/Dependencies) : MKL libraries was not found - it seems that MKL run-time libraries changed directories from version 19 to 20.

2) To solve the issue, simply add to global variable PATH MKL run-time libraries (here mkl_core and mkl_intel_thread).

Upvotes: 3

Related Questions