小编use*_*468的帖子

压缩列存储中的稀疏矩阵与列向量的乘法

我必须将压缩列存储中的稀疏矩阵与列向量相乘(我必须在开放式cl中并行化它)。我在互联网上进行了搜索。花了很多天但找不到任何东西。(我被允许搜索互联网因为我必须将其转换为并行)。但我只能找到压缩行存储的代码。

spmv_csr_serial(const int num_rows ,
                const int * ptr ,
                const int * indices ,
                const float * data ,
                const float * x,
                float * y)
{
    for(int row = 0; i < num_rows; i++){
        float dot = 0;
        int row_start = ptr[row];
        int row_end = ptr[row+1];

        for (int jj = row_start; jj < row_end; jj++)
            dot += data[jj] * x[indices[jj]];

        y[row] += dot;
    }
}
Run Code Online (Sandbox Code Playgroud)

压缩列存储没有行指针。那么如何将它与向量相乘呢?我只需要串行代码,然后我自己将其转换为并行代码。

这是我用于该项目的 OpenCL 内核

enter code here
__kernel void mykernel(__global const int* val,__global …
Run Code Online (Sandbox Code Playgroud)

c opencl

-2
推荐指数
1
解决办法
4676
查看次数

标签 统计

c ×1

opencl ×1