why I am getting this error "no instance of constructor", viennacl library in a CUDA optimizer, C++ console app

72 views Asked by At

I am trying to run this C++ console app project using cmakefile and I am getting this error for a cuda optimizer which was written in this project.

// wrap the existing CUDA CSR data in a viennacl::compressed_matrix:
    viennacl::compressed_matrix<double> vcl_A(d_L_Row, d_L_Col, d_L, viennacl::CUDA_MEMORY, ncols, ncols, nnzL);
    viennacl::vector<double> vcl_R(d_R, viennacl::CUDA_MEMORY, ncols);
    viennacl::vector<double> vcl_X(X, viennacl::CUDA_MEMORY, ncols);

for above part of code shows this error:

no instance of constructor "viennacl::compressed_matrix<NumericT, AlignmentV>::compressed_matrix [with NumericT=double, AlignmentV=1U]" matches the argument list

what exactly this means? how to fix it?

1

There are 1 answers

1
Karl Rupp On

The error message states that your line

viennacl::compressed_matrix<double> vcl_A(d_L_Row, d_L_Col, d_L, viennacl::CUDA_MEMORY, ncols, ncols, nnzL)

does not match the expected signature. In this particular case the constructor is defined as

explicit compressed_matrix(unsigned int *mem_row_buffer,
                           unsigned int *mem_col_buffer,
                           NumericT *mem_elements,       // NumericT is double as per template argument
                           viennacl::memory_types mem_type,                              
                           vcl_size_t rows,  // size_t
                           vcl_size_t cols,  // size_t 
                           vcl_size_t nonzeros) // size_t

Since integer conversion to vcl_size_t is unlikely to cause this error, most likely the pointer types do not match. Make sure d_L_Row and d_L_Col are pointers to unsigned int and d_L is a pointer to double. Your compiler has probably provided additional hints as to why the matching fails.

Since you are using CUDA, also make sure that the preprocessor define VIENNACL_WITH_CUDA is set before the respective #include statements for the ViennaCL headers.