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.

Reply via email to