Using Cusp with LAPACK

51 views
Skip to first unread message

xaldu...@gmail.com

unread,
Jul 11, 2016, 2:14:52 PM7/11/16
to cusp-users
Hi!

I want to use the interface to LAPACK of Cusp to do LU factorization of a dense system. To try this I started with the example shown in the doc:

#include <cusp/array2d.h>

#include <cusp/print.h>

#include <cusp/gallery/poisson.h>

// include cusp lapack header file

#include <cusp/lapack/lapack.h>

int main()

{

  // create an empty dense matrix structure

  cusp::array2d<float,cusp::host_memory> A;

  cusp::array1d<float,cusp::host_memory> piv;

  // create 2D Poisson problem

  cusp::gallery::poisson5pt(A, 4, 4);

  // compute LU factorization of A

  cusp::lapack::getrf(A, piv);

  // print the contents of A

  cusp::print(A);

  // print the contents of piv

  cusp::print(piv);

}


However I'm getting the following compilation error:


/home/mbrenesn/cusplibrary/cusp/lapack/detail/generic.h(55): error: no instance of overloaded function "cusp::lapack::detail::getrf" matches the argument list

            argument types are: (int, int, int, ValueType *, int, IndexType *)

          detected during:

            instantiation of "void cusp::lapack::generic::getrf(thrust::execution_policy<DerivedPolicy> &, Array2d &, Array1d &) [with DerivedPolicy=cusp::system::cpp::detail::par_t, Array2d=cusp::array2d<float, cusp::host_memory, cusp::row_major>, Array1d=cusp::array1d<float, cusp::host_memory>]" 

/home/mbrenesn/cusplibrary/cusp/lapack/detail/lapack.inl(37): here

            instantiation of "void cusp::lapack::getrf(const thrust::detail::execution_policy_base<DerivedPolicy> &, Array2d &, Array1d &) [with DerivedPolicy=cusp::system::cpp::detail::par_t, Array2d=cusp::array2d<float, cusp::host_memory, cusp::row_major>, Array1d=cusp::array1d<float, cusp::host_memory>]" 

/home/mbrenesn/cusplibrary/cusp/lapack/detail/lapack.inl(51): here

            instantiation of "void cusp::lapack::getrf(Array2d &, Array1d &) [with Array2d=cusp::array2d<float, cusp::host_memory, cusp::row_major>, Array1d=cusp::array1d<float, cusp::host_memory>]" 

test2.cu(14): here


(I just tried creating an object file by issuing "nvcc getrf.cu -c -I$CUSP_DIR -I$OPENBLAS_INC", should be able to link properly afterwards). 


I'm working off the development branch from github. 


Please help and thank you for your time.


Marlon B.

Steven Dalton

unread,
Jul 11, 2016, 2:26:16 PM7/11/16
to cusp-...@googlegroups.com
Try changing

cusp::array1d<float,cusp::host_memory> piv;

to

cusp::array1d<int,cusp::host_memory> piv;

since the pivot column is assumed to be of type int in the lapack interface.

Steve

--
You received this message because you are subscribed to the Google Groups "cusp-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cusp-users+...@googlegroups.com.
To post to this group, send email to cusp-...@googlegroups.com.
Visit this group at https://groups.google.com/group/cusp-users.
For more options, visit https://groups.google.com/d/optout.

xaldu...@gmail.com

unread,
Jul 11, 2016, 2:42:05 PM7/11/16
to cusp-users
Hi Steve,

Thank you for your prompt reply. That fixed it.

Marlon B.
Reply all
Reply to author
Forward
0 new messages