CUDA with D?

Chris R Miller lordsauronthegreat at gmail.com
Sun Mar 1 01:17:02 PST 2009


Trass3r wrote:
> Chris R Miller schrieb:
>> Trass3r wrote:
>>> Is there any tutorial or code for using CUDA with D?
>>
>> Short answer: no.
>>
>> I looked into writing CUDA with D a while back. The problem is that
>> the CUDA C runtime and the D runtime are 100% incompatible. CUDA works
>> by taking C-like code and compiling it with a special NVCC compiler,
>> which emits code that's specifically for NVIDIA GPUs.
>>
>
> What a pity, just read that article and thought it might be possible to
> get it to work:
> http://www.ddj.com/architect/211800683
>
> But thanks for your answer. Saves me some time ;)

And I quote:

# A more flexible and powerful capability lies in the ability of many
# languages -- such as Python, Perl, and Java -- to be extended through
# modules written in C, or CUDA when programming for GPU environments.

You're still writing in C, just using D to make an (extern) function 
call.  So it's not exactly D on the GPU, so I don't think it counts - 
plus the build sequence to build the C part with GCC->NVCC pass-through 
(or the MSVC->NVCC pass-through) would be a absolute nightmare to work with.

I looked into OpenCL, which appears (at first glance) to be a funky way 
of stringing together assembler instructions using C function calls. 
I'm sure it's fast, but it's not the most friendly looking code to me 
(then again, I don't know ASM, so what do I know?)


More information about the Digitalmars-d-learn mailing list