CUDA with D working after all
Robert Jacques
sandford at jhu.edu
Tue Jul 21 19:27:51 PDT 2009
On Tue, 21 Jul 2009 21:48:45 -0400, Trass3r <mrmocool at gmx.de> wrote:
> Robert Jacques schrieb:
>> Here:
>> https://jshare.johnshopkins.edu/xythoswfs/webui/_xy-3638242_1-t_5kUrZSWG
>> It requires D2 and the new phobos and CUDA 2.2. It's only been tested
>> on XP and Vista and D2.031. If you need a D1 version, let me know and
>> I'll hunt down an old revision. The ddocs for cuda.api and cuda.tests
>> has some example usage. The D2 version has some pretty niffty features,
>> like struct support. Let me know if you need any help.
>
> What about that __thread storage class?
>
> class Device {
> protected:
> static __thread CUdevice dev; // This thread's GPU
> static __thread int gpu_id = 0; // This thread's GPU id
> static __thread int rev_major; // The major revision number
> static __thread int rev_minor; // The minor revision number
> static __thread size_t totalGM; // Total global memory
> static __thread string dev_name; // Device name
> static __thread CUdevprop prop; // This device's properties
> static __thread CUcontext ctx; // This device's context
> static __thread isValid = false; // Is the device alive
>
>
> Does this combination of static and __thread work?
> By the way, are static class members treated as "classic global data"?
>
>
> D 2.030:
> classic global storage now defaults to TLS (Thread Local Storage).
>
> D 2.013:
> Added __thread storage class for thread local storage. This is for
> testing purposes only to check out the machinery in the back end. The
> front end design of this will change.
Well, I could probably eliminate __thread now, but it doesn't seem to be
doing any harm. Device is in flux right now, as it's basically
transitioning from a class with data to a struct containing a bunch of
static functions. I don't have a multi-GPU setup (sadly) so I haven't
played around with any of the multi-gpu/context stuff in CUDA.
More information about the Digitalmars-d
mailing list