我想编写一个内核函数,将 2 个 CUSP 矩阵 A 和 B 作为输入,
然后将数据并行填充到 B 中。
#include <cusp/coo_matrix.h>
#include <cusp/print.h>
#include <iostream>
__global__ void kernel_example(cusp::coo_matrix<int,float,cusp::host_memory>* A,
cusp::coo_matrix<int,float,cusp::host_memory>* B){
printf("hello from kernel...");
//actual operations go here.
}
int main(void)
{
// allocate storage
cusp::coo_matrix<int,float,cusp::host_memory> A(4,3,6);
cusp::coo_matrix<int,float,cusp::host_memory> B(4,3,6);
// initialize matrix entries on host
A.row_indices[0] = 0; A.column_indices[0] = 0; A.values[0] = 10;
A.row_indices[1] = 0; A.column_indices[1] = 2; A.values[1] = 20;
A.row_indices[2] = 2; A.column_indices[2] = 2; A.values[2] = 30;
A.row_indices[3] = 3; A.column_indices[3] = 0; A.values[3] = 40;
A.row_indices[4] = 3; A.column_indices[4] = 1; A.values[4] = 50;
A.row_indices[5] = 3; A.column_indices[5] = 2; A.values[5] = 60;
kernel_example<<<1,1>>>(A,B);
cudaDeviceSynchronize();
return 0;
}
出现以下错误:
error: no suitable conversion function from "cusp::coo_matrix<int, float, cusp::host_memory>" to "cusp::coo_matrix<int, float, cusp::host_memory> *" exists
我该怎么做?