Boost logo

Ublas :

Subject: Re: [ublas] ublas and nvidia cuda
From: Manuel González (iinmgc00_at_[hidden])
Date: 2010-05-06 10:23:47


The CUDA compiler (nvcc) only supports C and a very small subset of C++, and
therefore I think that ublas cannot be compiled in this environment.

But there are other alternatives:

1) If you need dense storage, CUDA provides its own implementations for BLAS
(CUBLAS) and Lapack (CULA):

2) If you need sparse storage, the SpeedIT project implements a kind of
"sparse blas3" and iterative solvers in CUDA:

3) If the above-mentioned libraries are not enought, and you need to code
some specific LA in CUDA, Nvidia provides a CUDA interface resembling the
C++ STL which can help (because the "official" STL is not supported in

You shoud take into account the time lost in memory transactions between the
CPU and the GPU: if you only use the GPU for some parts of your code and the
linear algebra problems are not big, you will not get any gain from using
the GPU. Here you have some memory transaction times for my Intel Core I7

memory chunk of 16384.0 Kb 7.152 ms/transaction (2345.9 Mb/s)
memory chunk of 1024.0 Kb: 0.754 ms/transaction (1389.8 Mb/s)

Best regards,

Manuel J. González Castro
Laboratorio de Ingeniería Mecánica - Universidad de A Coruña

Escuela Politécnica Superior
Mendizábal s/n, 15403 Ferrol

ublas-bounces_at_[hidden] wrote:
> Hi!
> Has anybody out there already played around with the (relatively) new
> CUDA Toolkit
> (
> toolkit.html) and ublas? Does it support "enough" C++ to compile code
> which uses ublases (sparse) matrix types? I gather there is a big
> issue with virtual functions...
> Does anybody have example code which uses ublas' types and runs on a
> GPGPU (compiling with nvcc) ?
> Are there (official) plans to exploit GPGPU computing power for LA
> with ublas? (Bindings?)
> Sorry for these very broad questions, but since these new fermi GPUs
> seem so inexpensive, it could give my calculations a big "boost" (and
> for the weak pun:-).
> Thanks for any insights
> Tim