Skip to content

How to use SpBlas  #1

@AviAvni

Description

@AviAvni

I'm trying to use the SpBlas API but get error

static void Main(string[] args)
{
    double[] values_A = { 10, 11, 12, 13, 15, 14, 16, 17, 18, 19 };
    int[] columns_A = { 0, 1, 2, 3, 0, 4, 1, 2, 3, 4 };
    int[] rowIndex_A1 = { 0, 2, 4, 6, 8, 10 };
    int[] rowIndex_A2 = { 2, 4, 6, 8, 10 };

    double[] values_B = { 5, 6, 7, 8, 9 };
    int[] columns_B = { 0, 1, 2, 3, 4 };
    int[] rowIndex_B1 = { 0, 1, 2, 3, 4, 5 };
    int[] rowIndex_B2 = { 1, 2, 3, 4, 5 };

    var a = new SparseMatrix();
    var b = new SparseMatrix();

    var res = SpBlas.MklSparseDCreateCsr(a, SparseIndexBaseT.SPARSE_INDEX_BASE_ZERO, 5, 5, ref rowIndex_A1[0], ref rowIndex_A2[0], ref columns_A[0], ref values_A[0]);
    res = SpBlas.MklSparseDCreateCsr(b, SparseIndexBaseT.SPARSE_INDEX_BASE_ZERO, 5, 5, ref rowIndex_B1[0], ref rowIndex_B2[0], ref columns_B[0], ref values_B[0]);

    var c = new SparseMatrix();
    res = SpBlas.MklSparseSpmm(SparseOperationT.SPARSE_OPERATION_NON_TRANSPOSE, a, b, c); // res is IntelMKL.LP64.SparseStatusT.SPARSE_STATUS_NOT_SUPPORTED
    res = SpBlas.MklSparseDSetValue(a, 1, 2, 10); // Exception: System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'

}

What is wrong here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions