Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
The Intel sign-in experience is changing in February to support enhanced security controls. If you sign in, click here for more information.
6680 Discussions

Module not found exception calling dgetrs

CraigP
Beginner
1,021 Views

I'm using Visual Studio Community Edition 2022 and the latest release of the oneAPI mkl libraries. 

Can you help me resolve the exception shown below. The inputs to the function are correct. I have no problem calculating the solution using my own home made functions for solving linear equations. The coefficient matrix size is 20 x 20. The call to dgetrf immediately precedes this call and returns an info value of 0.

 

CraigP_0-1646420267507.png

 

Here is the debugger output window output.

'CraigsSystem.exe' (Win32): Loaded 'D:\Craig\Visual Studio 2022\Projects\CraigsSystem\x64\Debug\CraigsSystem.exe'. Symbols loaded.
'CraigsSystem.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'.
'CraigsSystem.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'.
'CraigsSystem.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'.
'CraigsSystem.exe' (Win32): Loaded 'D:\Craig\Visual Studio 2022\Projects\CraigsSystem\x64\Debug\mkl_rt.2.dll'. Module was built without symbols.
'CraigsSystem.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140d.dll'.
'CraigsSystem.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140_1d.dll'.
'CraigsSystem.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140d.dll'.
'CraigsSystem.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'.
The thread 0x1844 has exited with code 0 (0x0).
'CraigsSystem.exe' (Win32): Loaded 'D:\Craig\Visual Studio 2022\Projects\CraigsSystem\x64\Debug\mkl_intel_thread.2.dll'. Module was built without symbols.
'CraigsSystem.exe' (Win32): Loaded 'D:\Craig\Visual Studio 2022\Projects\CraigsSystem\x64\Debug\mkl_core.2.dll'. Module was built without symbols.
'CraigsSystem.exe' (Win32): Loaded 'D:\Craig\Visual Studio 2022\Projects\CraigsSystem\x64\Debug\libimalloc.dll'. Module was built without symbols.
'CraigsSystem.exe' (Win32): Unloaded 'D:\Craig\Visual Studio 2022\Projects\CraigsSystem\x64\Debug\libimalloc.dll'
'CraigsSystem.exe' (Win32): Loaded 'D:\Craig\Visual Studio 2022\Projects\CraigsSystem\x64\Debug\libimalloc.dll'. Module was built without symbols.
'CraigsSystem.exe' (Win32): Unloaded 'D:\Craig\Visual Studio 2022\Projects\CraigsSystem\x64\Debug\libimalloc.dll'
'CraigsSystem.exe' (Win32): Loaded 'D:\Craig\Visual Studio 2022\Projects\CraigsSystem\x64\Debug\mkl_avx2.2.dll'. Module was built without symbols.
'CraigsSystem.exe' (Win32): Loaded 'D:\Craig\Visual Studio 2022\Projects\CraigsSystem\x64\Debug\mkl_vml_avx2.2.dll'. Module was built without symbols.
Exception thrown at 0x00007FFABA794F69 (KernelBase.dll) in CraigsSystem.exe: 0xC06D007E: Module not found (parameters: 0x000000E9A18FAAE0).
Unhandled exception at 0x00007FFABA794F69 (KernelBase.dll) in CraigsSystem.exe: 0xC06D007E: Module not found (parameters: 0x000000E9A18FAAE0).

 

 

0 Kudos
9 Replies
Gennady_F_Intel
Moderator
992 Views

Craig,

At the very first glance, the parameters you use are correct.

Give us an example that we could build and check the behavior on our end...



mecej4
Black Belt
906 Views

Quite frequently, a run time error/abort occurs when an MKL routine is called with one or more incorrect arguments. Without being able to see the declarations of the argument variables, and without knowing their values, it is often quite difficult to diagnose errors.

In this case, the routine has the calling sequence

lapack_int LAPACKE_dgetrs (int matrix_layout , char trans , lapack_int n , lapack_int nrhs , const double * a , lapack_int lda , const lapack_int * ipiv , double * b , lapack_int ldb );

Since you have specified nrhs = 1, the argument b should be a vector with at least n rows and 1 column. Therefore, ldb should be at least n. You are passing  1 instead. Similar errors may affect some of the other arguments.

As Gennady_F said, provide more details regarding the arguments, or provide example code that can be compiled and run.

CraigP
Beginner
851 Views

Thank you for helping.  I found that Idb incorrectly set the calling arguments n and ldb.

I set n equal to the number of rows in A times the number of columns in A and ldb equal to the number of row in B.  That solved the problem.

 

The mkl manual defines n as follows:   n = The order of A; the number of rows in B (n>= 0)

I was confused by that and had n set to the number of rows in B.  It would help to clarify that definition by removing the "the number of rows in B.

 

Thanks again

Craig.

mecej4
Black Belt
764 Views

@CraigP wrote:

"I set n equal to the number of rows in A times the number of columns in A and ldb equal to the number of row in B.  That solved the problem."

That does not sound correct at all. You say that the problem was solved, but I am reluctant to let that statement stand uncontested because someone finding this thread after a search for "Lapacke_dgetrf" may come to this post at some future date and adopt that incorrect conclusion.

The OneAPI MKL distribution comes with a collection of example source files zipped together. After extracting the zip files, one finds the following example: "...\examples\lapacke\source\lapacke_dgesv_row.c" . That example can be adapted for calling lapacke_dgetrf and then lapacke_dgetrs as follows. Add a declaration for the variable m = number of rows of matrix A, and replace the call to lapacke_dgesv by the pair of calls shown below.

 

...
MKL_INT m = N;
...
info = LAPACKE_dgetrf( LAPACK_ROW_MAJOR, m, n, a, lda, ipiv );
info = LAPACKE_dgetrs( LAPACK_ROW_MAJOR, 'N', n, nrhs, a, lda, ipiv,			b, ldb );

 

The output should be the same as the one shown in comments in the beginning of the file.

 When you call Lapack routines with matrix arguments that are stored by rows, the "leading dimension" is the row-size. For an m X n matrix A stored by rows, ldA should then be equal to n. Similarly, for the r.h.s. matrix B stored by rows, ldB = nrhs. You can see these settings in the example source code lapacke_dgesv_row.c, as well.

Gennady_F_Intel
Moderator
842 Views

thanks for the feedback, Craig. We will check this description.

This thread is closing and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only. 


CraigP
Beginner
750 Views

I attached a .csv file containing the 20 x 20 coefficient matrix for the equation system I am trying to solve, I can calculate an inverse for it in Microsoft Excel. I have no problems solving it with my homemade LUD decomposition and back substitution functions.

I tried solving the equations using dgesv(). I get the module not found exception from dgetrs().

I also tried using dpotrf() and dpotrs(). I had the same problem with those.

Here is dgetrf() are the dgetrs() calls I am using.  I receive an info value of 0 from dgetrf();

The calls work on simple 3x3 toy problem I use to validate them.

 

try
{
info = LAPACKE_dgetrf(LAPACK_ROW_MAJOR, A.nRows, A.nColumns, aP, A.nColumns, ipiv);
} catch (...)
{
printf("LAPACKE_dgetrf() threw an exception\n");
free(aP);
delete ipiv;
return Result;
}

if( info != 0 )
{
free(aP);
delete ipiv;
return Result;
}

//
// Calculate solution
//
Result = B;
try
{
info = LAPACKE_dgetrs( LAPACK_ROW_MAJOR, 'N', B.nRows, 1, aP, A.nColumns, ipiv, Result.data, 1 );
} catch (...)
{
printf("LAPACKE_dgetrs() threw an exception\n" );
free(aP);
delete ipiv;
return Result;
}

if( info != 0 )
{
free(aP);
delete ipiv;
Result.Flush();
return Result;
}

 

 

mecej4
Black Belt
697 Views

Fragments of code are rarely sufficient to enable pinpointing sources of error. Please provide the complete test code that you use to read the data file and solve the equations. 

I suspect that the errors are related to passing improper values of arguments to the LapackE routines. If so, obtaining correct solutions in Excel, etc.,  simply establishes that the problem is well-posed and has a solution. With correct calls to MKL, the MKL calls should produce a solution that agrees, to a reasonable number of digits.

If you are solving the linear system A.x = b, why would you calculate the inverse of A? What are the values in the r.h.s. vector b? 

CraigP
Beginner
621 Views

Thanks for getting back to me. Proving you the code is not feasible.

I just installed the latest release of the mkl libraries and the latest Visual Studio Community Edition update. I'm still getting module not found exceptions. from dgetrs(), dgesv() and dpotrs(). 

My calling code works just fine on a small 3x3 problem.  I have been using these calls with the last 32 bit version of the mkl libraries for several years and have not had problems.  My home made equation solving code solves them with no problem.

I am attaching two csv files containing a sample coefficient matrix and sample right hand side.

Please solve the equation using dgetdf - dgetrs and dgesv and send me a dot cpp or dot c file containing the code you used to solve it.

 

Thank you for your help

Craig

 

mecej4
Black Belt
541 Views

If you are still getting "module not found" exceptions, you have a faulty software installation (compiler, libraries, etc.). Without your providing enough information to allow us to reproduce the exception, no progress is possible. I recommend that you work on correctly installing MKL and supporting software and check by testing the relevant example source files provided with MKL.

As I wrote earlier, the example C source file "...\examples\lapacke\source\lapacke_dgesv_row.c" can be adapted to solve this problem. All that you have to do is to allocate the arrays A and B to the sizes needed, and add lines of code to open and read your CSV files to fill the two arrays A and B with values. 

It so happens that the matrix A in your A.csv file is poorly conditioned, so you should not expect the resulting solution to be accurate. You may see something close to:

 

 -3.390e-17  6.552e-04  5.348e-04 ... -2.282e+02 -5.749e+02  4.927e+04

 

I have shown only the first three and last three values in the solution vector x. 

Reply