Skip to content

Segfault when trying to call MKL gemm #7

@ValouBambou

Description

@ValouBambou

When I tried to execute this simple program it segfaults in the MKL function, which does not happen when I do the same operation in C. So I'm confused, it also segfaults with dgemm.

extern crate cblas;
extern crate intel_mkl_src;

use cblas::*;

fn main() {
    let (m, n, k) = (1024, 1024, 1024);
    let a: Vec<f32> = (0..(m * k)).map(|i| i as f32).collect();
    let b: Vec<f32> = (0..(k * n)).map(|i| i as f32).collect();
    let mut c: Vec<f32> = (0..(m * n)).map(|_| 0.0).collect();
    unsafe {
        sgemm(
            Layout::RowMajor,
            Transpose::None,
            Transpose::None,
            m,
            n,
            k,
            1.0,
            &a,
            k,
            &b,
            n,
            0.0,
            &mut c,
            n,
        )
    }
}

My Cargo.toml file is containing only those dependencies which should work (both static and dynamic produces the segfault):

cblas = "0.4"
intel-mkl-src = {version = "0.8", features = ["mkl-dynamic-ilp64-seq"]}

Does anyone encounter this issue ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions