xiaotaiye / cusp-library

Automatically exported from code.google.com/p/cusp-library
Apache License 2.0
0 stars 0 forks source link

CUSP 0.3.0 breaks with CUDA5? #105

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I have a simple cuda code as below for multiplication of a sparse matrix with 
dense vector. This code however does not compile. I am attaching the compiler 
output

int cuMain()
{
    std::cout << "    Cusp   v" << CUSP_MAJOR_VERSION << "." <<
               CUSP_MINOR_VERSION << "." <<
               CUSP_SUBMINOR_VERSION << std::endl;

    //creates a host COO with 5 rows, 8 cols and 12 non-zero elements
    cusp::coo_matrix<int, float, cusp::host_memory> A(5,8,6);
    A.row_indices[0] = 0 ; A.column_indices[0] = 0 ; A.values[0] = 3.0f;
    A.row_indices[1] = 1 ; A.column_indices[1] = 1 ; A.values[1] = 6.0f;
    A.row_indices[2] = 2 ; A.column_indices[2] = 2 ; A.values[2] = 9.0f;
    A.row_indices[3] = 3 ; A.column_indices[3] = 4 ; A.values[3] = 8.0f;
    A.row_indices[4] = 4 ; A.column_indices[4] = 4 ; A.values[4] = 4.0f;
    A.row_indices[5] = 4 ; A.column_indices[5] = 5 ; A.values[5] = 7.0f;

    //create a dense COO vector
    cusp::array1d<int, cusp::host_memory> B(8);
    for( int i=0 ; i<8 ; i++ )
        B[i] = i+1;

    //create output vector
    cusp::array1d<int, cusp::device_memory> d_out(5);

    //copy to device
    cusp::csr_matrix<int, float, cusp::device_memory> d_A = A;
    cusp::array1d<int, cusp::device_memory> d_B = B;

    // d_out = d_A * d_B;
    cusp::multiply(d_A, d_B, d_out );

    cusp::print(A);

    return 0;
}

What is the expected output? What do you see instead?
I would have expected that this works correctly to give the multiplication 
result

What version of the product are you using? On what operating system?
Ubuntu 12.04 with Cuda5 & CUSP 0.3.0

Please provide any additional information below.

Original issue reported on code.google.com by swaroopc...@gmail.com on 27 Apr 2013 at 10:31

Attachments: