DCompute: First kernels run successfully

Nicholas Wilson via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Mon Sep 11 15:56:14 PDT 2017


On Monday, 11 September 2017 at 20:45:43 UTC, kerdemdemir wrote:
> Hi Wilson,
>
> Since I believe GPU-CPU hybrid programming is the future I 
> believe you are doing a great job for your and D lang's future.
>
>> To successfully run the dcompute CUDA test you will need a 
>> very recent LDC (less than two days) with the NVPTX backend* 
>> enabled along with a CUDA environment and an Nvidia GPU.
>>
>> *Or wait for LDC 1.4 release real soon(™).
>
> Can you please describe a bit about for starters like me how to 
> build recent LDC.
>
> Is this "NVPTX backend" a cmake option?
> And what should I do for making my "CUDA environment" ready? 
> Which packages should I install?
>
> Sorry if my questions are so dummy I hope I will be able to add 
> an example.
>
> Regards
> Erdem


Hi Erdem

Sorry I've been a bit busy with uni. To build LDC just clone ldc 
and `git submodule --init` and run cmake, setting LLVM_CONFIG to 
/path/to/llvm/build/bin/llvm-config and LLVM_INTRINSIC_TD_PATH to 
/path/to/llvm/source/include/llvm/IR

The nvptx backend is enabled by setting LLVM's cmake variable 
LLVM_TARGETS_TO_BUILD to either "all", or "X86;NVPTX" along with 
any other archs you want to enable, (without the quotes) and then 
building LLVM with cmake. This will get picked up by LDC 
automatically.

I just installed the CUDA sdk in its entirety, but I'm sure you 
don't need everything from it.



More information about the Digitalmars-d-announce mailing list