Re: First time using Parallel

2021-12-26 Thread Era Scarecrow via Digitalmars-d-learn
On Sunday, 26 December 2021 at 15:36:54 UTC, Bastiaan Veelo wrote: On Sunday, 26 December 2021 at 15:20:09 UTC, Bastiaan Veelo wrote: So if you use `workerLocalStorage` ... you'll get your output in order without sorting. Scratch that, I misunderstood the example. It doesn't solve ordering.

Re: First time using Parallel

2021-12-26 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 26 December 2021 at 15:20:09 UTC, Bastiaan Veelo wrote: So if you use `workerLocalStorage` to give each thread an `appender!string` to write output to, and afterwards write those to `stdout`, you'll get your output in order without sorting. Scratch that, I misunderstood the

Re: First time using Parallel

2021-12-26 Thread Era Scarecrow via Digitalmars-d-learn
On Sunday, 26 December 2021 at 11:24:54 UTC, rikki cattermole wrote: I would start by removing the use of stdout in your loop kernel - I'm not familiar with what you are calculating, but if you can basically have the (parallel) loop operate from (say) one array directly into another then you

Re: First time using Parallel

2021-12-26 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 26 December 2021 at 06:10:03 UTC, Era Scarecrow wrote: [...] ```d foreach(value; taskPool.parallel(range) ){code} ``` [...] Now said results are out of order [...] So I suppose, is there anything I need to know? About shared resources or how to wait until all threads are

Re: First time using Parallel

2021-12-26 Thread rikki cattermole via Digitalmars-d-learn
On 27/12/2021 12:10 AM, max haughton wrote: I would start by removing the use of stdout in your loop kernel - I'm not familiar with what you are calculating, but if you can basically have the (parallel) loop operate from (say) one array directly into another then you can get extremely good

Re: First time using Parallel

2021-12-26 Thread max haughton via Digitalmars-d-learn
On Sunday, 26 December 2021 at 06:10:03 UTC, Era Scarecrow wrote: This is curious. I was up for trying to parallelize my code, specifically having a block of code calculate some polynomials (*Related to Reed Solomon stuff*). So I cracked open std.parallel and looked over how I would manage

First time using Parallel

2021-12-25 Thread Era Scarecrow via Digitalmars-d-learn
This is curious. I was up for trying to parallelize my code, specifically having a block of code calculate some polynomials (*Related to Reed Solomon stuff*). So I cracked open std.parallel and looked over how I would manage this all. To my surprise I found ParallelForEach, which gives the