Skip to content

segfault of matrix dot product when use openblas on windows 10 #1110

Closed
@zhongyi51

Description

@zhongyi51

Hello... I am trying to statically link openblas to my rust project with ndarray. However, I found when the matrix size is higher than 64, a segfault error will be thrown.

The source code is:

extern crate blas_src;
use ndarray::{Array2, Array};
use std::time::SystemTime;
fn main() {
    let mut aa =Array2::<f64>::zeros((5000,5000));
    let mut ab =Array2::<f64>::zeros((5000,5000));
    for i in 0..5000_usize{
        for j in 0..5000_usize{
            aa[(i,j)]=0.14_f64;
            ab[(j,i)]=0.21_f64;
        }
    }

    let t0=SystemTime::now();
    for i in 0..10{
        let res=aa.dot(&ab);
        println!("{}",res[(2,3)]);
    }
    println!("spend {} ms",t0.elapsed().unwrap().as_millis());
}

When I change the matrix size below 64, anything will be fine; however, this error will be thrown when matrix size is higher than 64:
The error massage is:
error: process didn't exit successfully: target\release\classgameground.exe (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)

I am so grateful for any help!

=============================================================
os: windows 10 professional 19042.1288
vcpkg version: 2021-11-02-af04ebf6274fd6f7a941bff4662b3955c64f6f42 (newest from github)
openblas-src version: 0.10 (vcpkg: openblas_x64-windows-static-md)
dependencies of project:
[dependencies] rand="0.8.4" ndarray = { version = "0.15.3", features = ["blas"] } blas-src = { version = "0.8", features = ["openblas"] } openblas-src = { version = "0.10", features = ["cblas","lapacke","system","static"] }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions