GPU / CUDA

seany seany at uni-bonn.de
Wed Mar 17 19:02:58 UTC 2021


Hi
I am looking for a way to parallelize my machine learning model 
in D.

I have ~100000 neurones, and just the initialization is very tme 
consuming.

I use the pseudocode :

foreach( some condition) {

foreach (other condition) {

allocate a neuron to detect a feature within a segment of an 
larger image.

}

}

The allocation is successful. But excruciatingly _slow_ - 
emphasis added.

So I tried to get started with dcompute.

My dub.json :

{
         "authors": [
                 "sean"
         ],
         "copyright": "Copyright © 2021, sean",
         "dependencies": {
                 "dlib": "~>0.20.0",
                 "dcompute": "~>0.1.0"
         },
         "description": "cuda test",
         "license": "proprietary",
         "name": "cudatest"
}



My code :

  @compute(CompileFor.deviceOnly) module mykernels;
import ldc.dcompute;
@kernel void mykernel(GlobalPointer!float a,GlobalPointer!float 
b, float c)
{
*a = *b + c;
}


I run it with :  dub build --compiler=ldc2

The result is : /usr/include/d/std/array.d(2975,13): Error: 
TypeInfo cannot be used with -betterC (using latest opensuse 
version for ldc)

I saw this : 
https://forum.dlang.org/thread/amcxssclbfaczrgqjqeo@forum.dlang.org

And this : 
https://speakerdeck.com/shigekikarita/grain-d-language-for-deep-learning?slide=17

I would like to have a step by step guid to handle a pair of 
foreach loops in dcompute please.

Thnak you



More information about the digitalmars-d-ldc mailing list