GPUs and Array Operations
Craig Black
cblack at ara.com
Tue Jul 10 07:27:48 PDT 2007
I don't know about standard C, but I can recommend the book GPU Gems 2.
It's full of content. A large portion of the book is dedicated to GPGPU
stuff.
-Craig
"Don Clugston" <dac at nospam.com.au> wrote in message
news:f6vaei$25hu$1 at digitalmars.com...
> Lutger wrote:
>> Craig Black wrote:
>>> Another idea. What if this could be done using the recently added mixin
>>> feature? Then you could use a shading language directly rather than
>>> trying to convert D code to a shading language. I've never used mixins,
>>> so I can't even think of how the syntax would look. Is this a practical
>>> idea?
>>>
>>> -Craig
>>
>> A solution like Blade* should be possible, especially when D gets some
>> macro syntactic sugar, but somewhat involved probably.
>
> It's certainly possible. It might not be too terrible, actually. I'm
> rewriting BLADE for the D conference; it now has syntax like:
>
> import blade;
>
> void main()
> {
> real result[]; double b[];
> alias b c;
> const x = 8.9884;
> real y = 234543;
> mixin(VEC("result+=b*3.5645 - x*43645*3124.543 +c[2..18]*y"));
> }
>
> By analyzing the complexity of the expression, it's possible to determine
> if
> it can easily be done with SSE1, SSE2, or x87, and if not, just do it with
> straight D instead. This is nice, because it means you don't have to worry
> about tricky cases. Using a mixin instead of operator overloading means
> you can detect aliasing. The same thing could be done for a GPU.
> In fact, the examples in NVIDIA's CUDA programming guide are perfect for
> BLADE, except that they aren't in C!
>
> Do you know where I could find some examples of using a GPU to do
> calculations (using standard C)?
> I think it would be easy to get BLADE to do it for a few simple cases.
More information about the Digitalmars-d
mailing list