CUDA bindings

ponce via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sun Oct 26 03:44:31 PDT 2014


On Sunday, 26 October 2014 at 05:31:52 UTC, Dmitri Nesteruk wrote:
> On Tuesday, 21 October 2014 at 08:31:03 UTC, ponce wrote:
>> On Thursday, 16 October 2014 at 21:18:15 UTC, ponce wrote:
>>> Dear D users,
>>>
>>> I'd like to announce DerelictCUDA, dynamic bindings to the 
>>> CUDA library.
>>> https://github.com/derelictorg/derelictcuda
>>>
>>> For now, only the CUDA Driver API is exposed, providing most 
>>> of the warp control.
>>>
>>> For a visual explanation of the different APIs in CUDA, see 
>>> http://stackoverflow.com/questions/242894/cuda-driver-api-vs-cuda-runtime
>>>
>>> More APIs could be implemented if the interest happens to be 
>>> non-null.
>>
>> CUDA Runtime API added.
>
> This is great! I know that C++ uses <<< and >>> to enclose 
> kernel calls and thus create the link between CPU and GPU code 
> when NVCC rips things apart. How is this done in your bindings?

The kernel launch syntax can only be used in CUDA when compiling 
for both device and host through nvcc. This isn't possible to 
have such with D code since nvcc won't take it. You have to 
compile the kernels separately, load them, and then use 
cudaLaunch or cuKernelLaunch instead (I suggest using string 
imports with PTX outputs or fatbin).

This makes CUDA programming arguably less practical than with 
C++, but combined host+device code tend to complicate build


More information about the Digitalmars-d-announce mailing list