SPMV functions in MKL Library cannot work properly on my computer. How can I fix it?

This is my first time working with the MKL library. After referring to the official documentation, I obtained the latest version of the MKL library via the apt package manager in the WSL2 Ubuntu system. I correctly configured the header and library paths in the CMake file. Then, I tested cblas_dgemv first and it worked fine. However, when I switched to using the CSR-related interfaces, I encountered an unusual error during runtime: the process terminated without any error message, and the exit code was 139. I will present the C++ code and CMake configuration I used for testing below:

#include <stdio.h>
#include <stdlib.h>
#include "mkl.h"

#define N 4  // Matrix dimension
#define NNZ 6 // Number of non-zero elements

// Auxiliary function: print a vector
void print_vector(const char* desc, int n, double* vec) {
    int i;
    printf("%sn", desc);
    for (i = 0; i < n; i++) {
        printf("%f ", vec[i]);
    }
    printf("n");
}

int main() {
    // Matrix and vector dimensions
    MKL_INT n = N;  // Matrix dimension
    MKL_INT nnz = NNZ;  // Number of non-zero elements

    // CSR matrix data: values, columns, rowIndex
    double values[NNZ] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0};  // Non-zero elements
    MKL_INT columns[NNZ] = {0, 1, 2, 1, 2, 3};  // Column indices of non-zero elements
    MKL_INT rowIndex[N + 1] = {0, 2, 3, 4, 6};  // Row start indices

    // Input vector (size N)
    double x[N] = {1.0, 1.0, 1.0, 1.0};  // Assume all elements are 1
    // Output vector (where results will be stored)
    double y[N] = {0.0, 0.0, 0.0, 0.0};

    // Create sparse_matrix_t object
    sparse_matrix_t A;
    sparse_status_t status;

    // Create CSR format matrix
    status = mkl_sparse_d_create_csr(&A, SPARSE_INDEX_BASE_ZERO, n, n, rowIndex, rowIndex +1, columns, values);
    if (status != SPARSE_STATUS_SUCCESS) {
        printf("Error creating sparse matrix: %dn", status);
        return 1;
    }

    // Perform matrix-vector multiplication
    double alpha = 1.0, beta = 0.0;

    // Create matrix descriptor and explicitly assign values
    matrix_descr descr{};
    descr.type = SPARSE_MATRIX_TYPE_GENERAL;    // Matrix type is general (non-symmetric)

    // Perform matrix-vector multiplication
    status = mkl_sparse_d_mv(SPARSE_OPERATION_NON_TRANSPOSE, alpha, A, descr, x, beta, y);
    if (status != SPARSE_STATUS_SUCCESS) {
        printf("Error in matrix-vector multiplication: %dn", status);
        return 1;
    }

    // Print result
    print_vector("Resulting vector y =", N, y);

    // Release resources
    mkl_sparse_destroy(A);

    return 0;
}

Next is my CMake configuration:

cmake_minimum_required(VERSION 3.27)
project(testMKL)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "-O3")

# Include header files
include_directories(/opt/intel/oneapi/mkl/2025.0/include)

# Link library directories
link_directories(/opt/intel/oneapi/mkl/2025.0/lib)

add_executable(testMKL main.cpp)

# Link the specific libraries: libmkl_rt
target_link_libraries(testMKL  -m64  -L /opt/intel/oneapi/mkl/2025.0/lib -Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl)

Finally, here is a screenshot about the error message I encountered during debugging:

It seems like there is an issue with the mkl_avx2 library, but my computer actually supports AVX instructions. How can I resolve this? I could not find official test code. The code above is written based on my own understanding. If there are any official versions of debugging and testing code or more specific code examples, I would appreciate it if someone could share them with me.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật