taco icon indicating copy to clipboard operation
taco copied to clipboard

Segfault while calling compile() for transposing CSR matrix

Open ShidehHashemian opened this issue 9 months ago • 0 comments

Hi,

I want to transpose a sparse matrix of CSR format, where the result's format is CSC. Here is the code snippet I wrote in cpp.

    int n = 4, m = 4;
    Tensor<float> A({n, m}, {Dense, Sparse});
    for (int i = 0; i < n; i++)
    {
        if (i + 1 < n)
            A.insert({i, i + 1}, (float)2.0);
        if (i - 1 >= 0)
            A.insert({i, i - 1}, (float)-2.0);
        A.insert({i, i}, (float)1.0);
    }
    A.pack();
    Tensor<float> B({n, m}, {Sparse , Dense});
    IndexVar i, j;
    B(i, j) = A(j, i);
    B.compile();

It fails on B.compile() returning Segfault. But the web tool can generate the code: link

My operating system is Ubuntu 22.04 LTS. I have built the version of TACO on the master branch as instructed. I didn't change the default compiler and optimization flags.

I would be grateful if you could help me with this problem.

ShidehHashemian avatar May 20 '24 14:05 ShidehHashemian