GPGPU progess

Nicholas Wilson via Digitalmars-d digitalmars-d at puremagic.com
Thu May 18 02:07:38 PDT 2017


On Thursday, 18 May 2017 at 05:39:52 UTC, Manu wrote:
> I just caught up on the dconf material. It was a really 
> interesting year, and I'm super bummed I missed it!
>
> So I'm just starting out on some GPGPU work, and I love the 
> direction we're going here.
>
> Given this scenario;
> I want to write CUDA kernels in D, and execute them in an 
> existing C++ CUDA
> app.

Can do already although not all the intrinsics are there yet, but 
they are very simple to add. See 
https://github.com/libmir/dcompute/blob/master/source/dcompute/std/cuda/index.d for how easy it is (PRs welcome!)

> Can anyone point me at the getting started material, how do I 
> achieve this
> seemingly simple goal?

If you're only interested in CUDA I think any LLVM 3.9.1 or 4.0 
should work, If you want SPIRV get my LLVM from 
https://github.com/thewilsonator/llvm/tree/compute

Get the dcompute branch of LDC ( 
https://github.com/ldc-developers/ldc/tree/dcompute) and its 
submodules (i.e. druntime, I don't think it points to a branch 
anymore because Johan deleted that when I merged that into the 
regular ldc druntime but it will still work.) The dcompute branch 
of LDC is in the process of being merged into master so expect 
some breakage when updating to that.

> Has anyone started on this content? Where are the toolchains, 
> how to I
> build a CUDA kernel, how do I link/load it in my C++ app?
>

There is some info on the dcompute wiki 
(https://github.com/libmir/dcompute/wiki) and I intend make this 
into "production quality" documentation (again PRs welcome or I 
can give you write access to the wiki), but I'm very busy at the 
moment.

When ldc runs you will get a kernels_cudaxxx_yy.ptx (where xxx is 
the CUDA compute capability specified on the command line and yy 
is 32 or 64 for 32 or 64bit) which should fit somewhere into your 
existing C++ pipeline.

> If this doesn't exist, there needs to be a wiki with getting 
> started guide covering various usage environments. I don't have 
> a lot of time to spare on detail, so success will depend on my 
> ability to hit the ground running, and that's really just a 
> matter of simple clear reference material.
>
> How far are we from integration into LDC without using forked 
> compilers?

Soon™, it the first thing I'm going to do (if I don't get it done 
before) after I hand in my honours thesis at the start of July. 
I'm stupidly busy this semester so don't count on it done 
beforehand.

If you have any questions about anything probably the fastest way 
is the libmir or ldc gitter channels. 
(https://gitter.im/ldc-developers/main , 
https://gitter.im/libmir/public).

Good luck! I look forward to your experience report.
Nic



More information about the Digitalmars-d mailing list