Subject: Re: [ublas] cublas bindings
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2010-07-20 02:54:33
Andrey Asadchev wrote:
> thank you
> I was not aware off existing bindings.
> I will definitely take a look at them.
> I am trying to make implementation little bit more like expressions,
> rather than fortran counterpart:
> Here is an example:
> cublas::matrix<double> A;
> cublas::matrix<double> B;
> B = cublas::matrix<double>(5,5);
> A = B; // device to device copy
> ublas::matrix<double> h(cublas::host(B)); // device to host copy
> ublas::matrix<double, ublas::column_major> f;
> cublas::host(f) = A; // device to host copy
> cublas::matrix<double> C = cublas::gemm(A, B);
> B += cublas::gemm(A, C);
> cublas::gemm(3.0, B, C, 6.0, A); // fortran style dgemm
We have chosen to put expression syntax and handling of that in the hands of
higher level libraries, e.g., MTL, GLAS, etc.. In turn, some of these
libraries have chosen to use the bindings for their BLAS/LAPACK access.
One of the things I would like to achieve with the bindings, are programs
that can be recompiled against (a mixture of) different backends, hybrid
and/or GPU-backends included. Then, it would be nice if users are able to
write code as if a GPU is present, but, if the CPU-only compilation option
is chosen, all host/device copying is ignored.