Re: Parallel For

2021-06-16 Thread jfondren via Digitalmars-d-learn
On Wednesday, 16 June 2021 at 06:29:21 UTC, z wrote: On Tuesday, 15 June 2021 at 06:39:24 UTC, seany wrote: ... This is the best I could do: https://run.dlang.io/is/dm8LBP For some reason, LDC refuses to vectorize or even just unroll the nonparallel version, and more than one `parallel` corru

Re: Parallel For

2021-06-15 Thread z via Digitalmars-d-learn
On Tuesday, 15 June 2021 at 06:39:24 UTC, seany wrote: ... This is the best I could do: https://run.dlang.io/is/dm8LBP For some reason, LDC refuses to vectorize or even just unroll the nonparallel version, and more than one `parallel` corrupts the results. But judging by the results you expec

Re: Parallel For

2021-06-15 Thread seany via Digitalmars-d-learn
On Tuesday, 15 June 2021 at 09:09:29 UTC, Ali Çehreli wrote: On 6/14/21 11:39 PM, seany wrote: > [...] I gave an example of it in my DConf Online 2020 presentation as well: https://www.youtube.com/watch?v=dRORNQIB2wA&t=1324s > [...] That is violating a pa

Re: Parallel For

2021-06-15 Thread Ali Çehreli via Digitalmars-d-learn
On 6/14/21 11:39 PM, seany wrote: > I know that D has parallel foreach [like > this](http://ddili.org/ders/d.en/parallelism.html). I gave an example of it in my DConf Online 2020 presentation as well: https://www.youtube.com/watch?v=dRORNQIB2wA&t=1324s > int[] c ; >

Re: Parallel For

2021-06-15 Thread seany via Digitalmars-d-learn
On Tuesday, 15 June 2021 at 07:41:06 UTC, jfondren wrote: On Tuesday, 15 June 2021 at 06:39:24 UTC, seany wrote: [...] add a `writeln(c.length);` in your inner loop and consider the output. If you were always pushing to the end of c, then only unique numbers should be output. But I see e.g. si

Re: Parallel For

2021-06-15 Thread jfondren via Digitalmars-d-learn
On Tuesday, 15 June 2021 at 06:39:24 UTC, seany wrote: What am I doing wrong? add a `writeln(c.length);` in your inner loop and consider the output. If you were always pushing to the end of c, then only unique numbers should be output. But I see e.g. six occurrences of 0, four of 8 ... Here's

Re: Parallel For

2021-06-14 Thread seany via Digitalmars-d-learn
On Tuesday, 15 June 2021 at 06:39:24 UTC, seany wrote: I know that c# has parallel for [like this](https://dotnettutorials.net/lesson/parallel-for-method-csharp/) . [...] PS : I need the entire include list - while they are not necessary for this minimal example - they are needed for the

Parallel For

2021-06-14 Thread seany via Digitalmars-d-learn
I know that c# has parallel for [like this](https://dotnettutorials.net/lesson/parallel-for-method-csharp/) . I know that D has parallel foreach [like this](http://ddili.org/ders/d.en/parallelism.html). I want to do the following : Given 4 sets , A = {a_1, a_2, ... }; B = {b_1, b_2

Re: How to use #pragma omp parallel for collapse(n) in dlang?

2019-08-22 Thread ijet via Digitalmars-d-learn
On Thursday, 15 August 2019 at 08:08:29 UTC, Daniel Kozak wrote: On Thu, Aug 15, 2019 at 9:44 AM Daniel Kozak wrote: [...] something like this: C version: [...] Thank you!

Re: How to use #pragma omp parallel for collapse(n) in dlang?

2019-08-15 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, Aug 15, 2019 at 9:44 AM Daniel Kozak wrote: > > On Tue, Aug 13, 2019 at 10:47 AM ijet via Digitalmars-d-learn > wrote: > > > > How to use #pragma omp parallel for collapse(n) in dlang? > > There is no OMP for de as I know, but you can just use

Re: How to use #pragma omp parallel for collapse(n) in dlang?

2019-08-15 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Aug 13, 2019 at 10:47 AM ijet via Digitalmars-d-learn wrote: > > How to use #pragma omp parallel for collapse(n) in dlang? There is no OMP for de as I know, but you can just use https://dlang.org/phobos/std_parallelism.html#.parallel for each 'foreach'

Re: How to use #pragma omp parallel for collapse(n) in dlang?

2019-08-15 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 13 August 2019 at 08:41:07 UTC, ijet wrote: How to use #pragma omp parallel for collapse(n) in dlang? I don’t understand the question. Bastiaan.

How to use #pragma omp parallel for collapse(n) in dlang?

2019-08-13 Thread ijet via Digitalmars-d-learn
How to use #pragma omp parallel for collapse(n) in dlang?