www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - GPU / CUDA

reply seany <seany uni-bonn.de> writes:
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
Mar 17 2021
parent reply Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Wednesday, 17 March 2021 at 19:02:58 UTC, seany wrote:
 Hi
 I am looking for a way to parallelize my machine learning model 
 in D.

 [...]
Are you on Discord or Slack? https://discord.gg/bMZk9Q4
Mar 17 2021
parent reply seany <seany uni-bonn.de> writes:
On Wednesday, 17 March 2021 at 23:13:07 UTC, Imperatorn wrote:
 On Wednesday, 17 March 2021 at 19:02:58 UTC, seany wrote:
 Hi
 I am looking for a way to parallelize my machine learning 
 model in D.

 [...]
Are you on Discord or Slack? https://discord.gg/bMZk9Q4
You have slack ?
Mar 18 2021
parent reply Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Thursday, 18 March 2021 at 09:04:10 UTC, seany wrote:
 On Wednesday, 17 March 2021 at 23:13:07 UTC, Imperatorn wrote:
 On Wednesday, 17 March 2021 at 19:02:58 UTC, seany wrote:
 Hi
 I am looking for a way to parallelize my machine learning 
 model in D.

 [...]
Are you on Discord or Slack? https://discord.gg/bMZk9Q4
You have slack ?
Yup
Mar 18 2021
parent reply seany <seany uni-bonn.de> writes:
On Thursday, 18 March 2021 at 09:44:19 UTC, Imperatorn wrote:
 On Thursday, 18 March 2021 at 09:04:10 UTC, seany wrote:
 On Wednesday, 17 March 2021 at 23:13:07 UTC, Imperatorn wrote:
 On Wednesday, 17 March 2021 at 19:02:58 UTC, seany wrote:
 Hi
 I am looking for a way to parallelize my machine learning 
 model in D.

 [...]
Are you on Discord or Slack? https://discord.gg/bMZk9Q4
You have slack ?
Yup
Share a slack link please. i did not receive the discord confirmation mail
Mar 18 2021
parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Thursday, 18 March 2021 at 12:55:05 UTC, seany wrote:
 On Thursday, 18 March 2021 at 09:44:19 UTC, Imperatorn wrote:
 On Thursday, 18 March 2021 at 09:04:10 UTC, seany wrote:
 On Wednesday, 17 March 2021 at 23:13:07 UTC, Imperatorn wrote:
 On Wednesday, 17 March 2021 at 19:02:58 UTC, seany wrote:
 Hi
 I am looking for a way to parallelize my machine learning 
 model in D.

 [...]
Are you on Discord or Slack? https://discord.gg/bMZk9Q4
You have slack ?
Yup
Share a slack link please. i did not receive the discord confirmation mail
You cannot just join slack the same way you can join Discord. You need to get an invitation. I got one from Sebastian Wilzbach.
Mar 18 2021