help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave and CUDA


From: Daniel Kraft
Subject: Re: Octave and CUDA
Date: Mon, 13 Jan 2014 07:49:20 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

Hi!

On 2014-01-13 07:33, Michael Pender wrote:
> Thanks for the reply.  I remember studying your work before and taking
> to heart the part about the overhead from memory copy operations.  I'd
> like to find a way to reserve memory on the CUDA platform and then keep
> it available, so that the overhead from copy operations and memory
> bandwidth is minimized, but Octave's pass-by-value approach and lack of
> a pointer data type makes it difficult.  I still think it is possible
> though...

Yes, that's a bit bad.  In general, I've multiple times had the feeling
that it would be great to have a way to define "new data types" for
Octave that could encapsulate external data structures (basically like
file handles and things like that) and would be "black boxes" for Octave
itself.

You can probably do it by storing a pointer reinterpret_cast'ed to
integer into an Octave variable, and using that "integer" as handle.  In
the case of GPU memory, you'd cuda_malloc the block and then cast the
resulting pointer; or you could even construct your own C++ data
structure holding the CUDA memory pointer plus additional data you want,
and store a pointer to your internal data structure in the Octave integer.

I've never tried that myself, though, since I've not had urgent needs
for it so far.  It is a hack, but I presume it would work.

Yours,
Daniel

-- 
http://www.domob.eu/
--
Done:  Arc-Bar-Cav-Hea-Kni-Ran-Rog-Sam-Tou-Val-Wiz
To go: Mon-Pri


reply via email to

[Prev in Thread] Current Thread [Next in Thread]