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

LAPACKE Matrix Factorization Routines (sgetrf, sgeqrf) Crash with Exit Code 0xC06D007E

draush
Beginner
895 Views

I'm encountering crashes specifically with LAPACKE matrix factorization routines in Intel oneAPI MKL 2025.0 on Windows. The program crashes with exit code 0xC06D007E when calling factorization routines like LAPACKE_sgetrf and LAPACKE_sgeqrf. Importantly, basic LAPACK operations and CBLAS functions work correctly.

 

I've attempted a reinstall of oneAPI MKL through this link to no avail.

 

Environment:
- Windows 10
- Intel CPU
- Intel oneAPI MKL 2025.0
- CMake 3.28
- C++17

Working Operations:
- Basic CBLAS operations
- LAPACKE_slacpy (matrix copy)
- LAPACKE_slantr (matrix norm)
- LAPACKE_slange (general matrix norm)
- LAPACKE_slaset (matrix initialization)

Failing Operations:
- LAPACKE_sgetrf (LU factorization)
- LAPACKE_sgeqrf (QR factorization)
- LAPACKE_sgetri (matrix inversion, fails at the required sgetrf step)

 

Steps to reproduce:
1. Create a new project with the attached CMakeLists.txt and main.cpp:

#include <iostream>
#include <mkl.h>
#include <mkl_lapacke.h>
#include <vector>

void print_matrix(const std::vector<float>& matrix, int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
std::cout << matrix[i * n + j] << " ";
}
std::cout << std::endl;
}
std::cout << std::endl;
}

int main() {
const int N = 3;

// First demonstrate a working LAPACK operation
std::cout << "Testing working LAPACK operation (matrix copy)..." << std::endl;
std::vector<float> test_matrix(N * N, 1.0f);
std::vector<float> matrix_copy(N * N);
MKL_INT info = LAPACKE_slacpy(LAPACK_ROW_MAJOR, 'A', N, N, test_matrix.data(), N, matrix_copy.data(), N);
std::cout << "LAPACKE_slacpy completed successfully with info = " << info << std::endl << std::endl;

// Now demonstrate the failing operation
std::cout << "Testing failing operation (LU factorization)..." << std::endl;
std::vector<float> matrix(N * N, 0.0f);
for (int i = 0; i < N; i++) {
matrix[i * N + i] = 1.0f;
}

std::cout << "Original matrix:" << std::endl;
print_matrix(matrix, N);

std::vector<MKL_INT> ipiv(N);
std::cout << "Beginning LAPACKE_sgetrf routine..." << std::endl;
info = LAPACKE_sgetrf(LAPACK_ROW_MAJOR, N, N, matrix.data(), N, ipiv.data());

// Note: The following lines will not be reached due to the crash
if (info != 0) {
std::cerr << "LU factorization failed with error " << info << std::endl;
return 1;
}

std::cout << "Matrix after LU factorization:" << std::endl;
print_matrix(matrix, N);

return 0;
}


2. Build and run

3. Output:

```

Testing working LAPACK operation (matrix copy)...
LAPACKE_slacpy completed successfully with info = 0

Testing failing operation (LU factorization)...
Original matrix:
1 0 0
0 1 0
0 0 1

Beginning LAPACKE_sgetrf routine...

Process finished with exit code -1066598274 (0xC06D007E)

```

Labels (1)
0 Kudos
1 Solution
draush
Beginner
815 Views

Thank you for your reply.

As I needed a solution quicker than the end of Q1 2025, I found a workaround for this problem by using the intel-mkl port through vcpkg.

View solution in original post

0 Kudos
3 Replies
Shiquan_Su
Moderator
868 Views

Hi,

I tested your example against our coming oneapi 2025.1.0 release. I don't see the error message on the second case anymore. Here is what I see:


shiquans@orcsle163:/cts/projects/shiquans/osc_06489336$ cat runme.sh

#!/bin/bash

module purge

module load utils/cmake-3.28.4

module load oneapi/2025.1.0-preview

cmake .

make

./mkl_bug

shiquans@orcsle163:/cts/projects/shiquans/osc_06489336$ . ./runme.sh

/cts/tools/utils/cmake-3.28.4/cmake-3.28.4-linux-x86_64//bin/cmake

/nfs/pdx/disks/cts2/tools/oneapi/2025.0.0-preview/compiler/2025.0/bin/icx

-- MKL_VERSION: 2025.0.0

-- MKL_ROOT: /nfs/pdx/disks/cts2/tools/oneapi/2025.0.0-preview/mkl/2025.0

-- MKL_ARCH: intel64

-- MKL_LINK: dynamic

-- MKL_INTERFACE_FULL: intel_ilp64

-- MKL_THREADING: intel_thread

-- MKL_MPI: intelmpi

-- Found /nfs/pdx/disks/cts2/tools/oneapi/2025.0.0-preview/mkl/2025.0/lib/libmkl_scalapack_ilp64.so

-- Found /nfs/pdx/disks/cts2/tools/oneapi/2025.0.0-preview/mkl/2025.0/lib/libmkl_cdft_core.so

-- Found /nfs/pdx/disks/cts2/tools/oneapi/2025.0.0-preview/mkl/2025.0/lib/libmkl_intel_ilp64.so

-- Found /nfs/pdx/disks/cts2/tools/oneapi/2025.0.0-preview/mkl/2025.0/lib/libmkl_intel_thread.so

-- Found /nfs/pdx/disks/cts2/tools/oneapi/2025.0.0-preview/mkl/2025.0/lib/libmkl_core.so

-- Found /nfs/pdx/disks/cts2/tools/oneapi/2025.0.0-preview/mkl/2025.0/lib/libmkl_blacs_intelmpi_ilp64.so

-- Found /nfs/pdx/disks/cts2/tools/oneapi/2025.0.0-preview/compiler/2025.0/lib/libiomp5.so

-- MKL::mkl_scalapack_ilp64;MKL::mkl_cdft_core;MKL::mkl_intel_ilp64;MKL::mkl_intel_thread;MKL::mkl_core;MKL::mkl_blacs_intelmpi_ilp64;MKL::MKL

-- Configuring done (0.1s)

-- Generating done (0.1s)

-- Build files have been written to: /cts/projects/shiquans/osc_06489336

[100%] Built target mkl_bug

Testing working LAPACK operation (matrix copy)...

LAPACKE_slacpy completed successfully with info = 0


Testing failing operation (LU factorization)...

Original matrix:

1 0 0

0 1 0

0 0 1


Beginning LAPACKE_sgetrf routine...

Matrix after LU factorization:

1 0 0

0 1 0

0 0 1


The oneAPI 2025.1.0 will be released around end of Q1 2025.



0 Kudos
draush
Beginner
816 Views

Thank you for your reply.

As I needed a solution quicker than the end of Q1 2025, I found a workaround for this problem by using the intel-mkl port through vcpkg.

0 Kudos
Fengrui
Moderator
772 Views

Hi,

 

I tried the code with the current oneMKL 2025.0.1 release and observed no issues. This exit code seems to be related to something else.

 

Thanks,

Fengrui

0 Kudos
Reply