www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - CUDA bindings

reply "ponce" <contact gam3sfrommars.fr> writes:
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.
Oct 16 2014
next sibling parent reply "Tofu Ninja" <emmons0 purdue.edu> writes:
On Thursday, 16 October 2014 at 21:18:15 UTC, ponce wrote:
 More APIs could be implemented if the interest happens to be 
 non-null.
Interest non-null, this is awesome.
Oct 17 2014
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 10/17/14, 7:58 AM, Tofu Ninja wrote:
 On Thursday, 16 October 2014 at 21:18:15 UTC, ponce wrote:
 More APIs could be implemented if the interest happens to be non-null.
Interest non-null, this is awesome.
Let it ride! http://www.reddit.com/r/programming/comments/2jiv21/derelictcuda_dynamic_bindings_to_the_cuda_library/ https://twitter.com/D_Programming/status/523135615521415171 Andrei
Oct 17 2014
prev sibling next sibling parent reply "bachmeier" <no spam.com> writes:
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.
Any chance of getting some math libraries like MAGMA? https://developer.nvidia.com/gpu-accelerated-libraries By the way, this is awesome work.
Oct 17 2014
parent reply "ponce" <contact gam3sfrommars.fr> writes:
On Friday, 17 October 2014 at 17:19:00 UTC, bachmeier 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.
Any chance of getting some math libraries like MAGMA?
These APIs rely on the Runtime API, I need to see if this API can be implemente first.
 https://developer.nvidia.com/gpu-accelerated-libraries

 By the way, this is awesome work.
Thanks, but honestly it is incomplete and wasn't much effort. I think we need some place (could be just a NG thread?) to express users needs for library/bindings. Else we don't really know what is missing.
Oct 18 2014
parent Paul O'Neil <redballoon36 gmail.com> writes:
On 10/18/2014 05:49 AM, ponce wrote:
 I think we need some place (could be just a NG thread?) to express users
 needs for library/bindings. Else we don't really know what is missing.
 
A wiki page might be better, so that it can be modified in place and always be up to date with requests and results. -- Paul O'Neil Github / IRC: todayman
Oct 18 2014
prev sibling parent reply "ponce" <contact gam3sfrommars.fr> writes:
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.
Oct 21 2014
parent reply "Dmitri Nesteruk" <a z.com> writes:
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?
Oct 25 2014
next sibling parent reply "Tofu Ninja" <emmons0 purdue.edu> writes:
On Sunday, 26 October 2014 at 05:31:52 UTC, Dmitri Nesteruk wrote:
 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?
It's just the driver api, its not CUDA code in D. Also I think you are mistaking where the <<< >>> are actually used. The <<< >>> are used in CUDA code, not in C++ code. While CUDA is a variation on C++, it is still not C++ and has to pass through a special parser that splits out the host code and the gpu code to be compiled.
Oct 26 2014
parent "ponce" <contact gam3sfrommars.fr> writes:
On Sunday, 26 October 2014 at 08:18:11 UTC, Tofu Ninja wrote:
 On Sunday, 26 October 2014 at 05:31:52 UTC, Dmitri Nesteruk 
 wrote:
 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?
It's just the driver api, its not CUDA code in D. Also I think you are mistaking where the <<< >>> are actually used. The <<< >>> are used in CUDA code, not in C++ code. While CUDA is a variation on C++, it is still not C++ and has to pass through a special parser that splits out the host code and the gpu code to be compiled.
Yeah even in C++ it isn't that desirable, apart from prototyping.
Oct 26 2014
prev sibling parent "ponce" <contact gam3sfrommars.fr> writes:
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
Oct 26 2014