Re: Better multithreading with D

2018-04-20 Thread 12345swordy via Digitalmars-d-learn
On Saturday, 21 April 2018 at 02:08:24 UTC, solidstate1991 wrote: In order to call a function multiple time at parallel (rendering function, very well parallelizable), but in order to push the CPU to it's limits I have to get some form of parallelization. Currently I'm using parallel foreach,

Better multithreading with D

2018-04-20 Thread solidstate1991 via Digitalmars-d-learn
In order to call a function multiple time at parallel (rendering function, very well parallelizable), but in order to push the CPU to it's limits I have to get some form of parallelization. Currently I'm using parallel foreach, which isn't very nice, and since it uses GC allocation that

Re: Multithreading in D

2014-11-02 Thread Russel Winder via Digitalmars-d-learn
On Thu, 2014-10-09 at 11:29 +, Sag Academy via Digitalmars-d-learn wrote: On Thursday, 9 October 2014 at 10:10:20 UTC, Konstantin wrote: Are you looking for parallel? http://dlang.org/library/std/parallelism/parallel.html I have seen this, but I'm not sure how to use it. Maybe:

Re: Multithreading in D

2014-10-09 Thread Konstantin via Digitalmars-d-learn
Are you looking for parallel? http://dlang.org/library/std/parallelism/parallel.html I have seen this, but I'm not sure how to use it. Maybe: float[][] maps = new float[#threads][resolution * resolution]; foreach(i, ref elem; parallel(maps)){ elem = generateTerrain(...); } Does this

Re: Multithreading in D

2014-10-09 Thread Sag Academy via Digitalmars-d-learn
On Thursday, 9 October 2014 at 10:10:20 UTC, Konstantin wrote: Are you looking for parallel? http://dlang.org/library/std/parallelism/parallel.html I have seen this, but I'm not sure how to use it. Maybe: float[][] maps = new float[#threads][resolution * resolution]; foreach(i, ref elem;

Re: Multithreading in D

2014-10-09 Thread Ali Çehreli via Digitalmars-d-learn
On 10/09/2014 03:10 AM, Konstantin wrote: Are you looking for parallel? http://dlang.org/library/std/parallelism/parallel.html I have seen this, but I'm not sure how to use it. I have the following chapter with some examples: http://ddili.org/ders/d.en/parallelism.html If concurrency is

Multithreading in D

2014-10-08 Thread Konstantin via Digitalmars-d-learn
Hello D-World, I've written a small terraingenerator in D based on the Hill-Algorithm. To generate a terrain I only need to call the method generateTerrain(...) which returns a float-Array containing the height of each pixel (2D Array mapped with a 1D array with length resolution^2).

Re: Multithreading in D

2014-10-08 Thread AsmMan via Digitalmars-d-learn
What I imagine as solution (I know it won't work this way, but to give you a better idea): for(int i = 0; i #threads; i++){ runInThread(generateTerrain(...)); } Are you looking for parallel? http://dlang.org/library/std/parallelism/parallel.html