Error running concurrent process and storing results in array

data pulverizer data.pulverizer at gmail.com
Wed May 6 08:18:32 UTC 2020


On Wednesday, 6 May 2020 at 07:47:59 UTC, drug wrote:
> 06.05.2020 10:42, data pulverizer пишет:
>> On Wednesday, 6 May 2020 at 07:27:19 UTC, data pulverizer 
>> wrote:
>>> On Wednesday, 6 May 2020 at 06:54:07 UTC, drug wrote:
>>>> Thing are really interesting. So there is a space to improve 
>>>> performance in 2.5 times :-)
>>>> Yes, `array` is smart enough and if you call it on another 
>>>> array it is no op.
>>>> What means `--fast` in Chapel? Do you try `--fast-math` in 
>>>> ldc? Don't know if 05 use this flag
>>>
>>> I tried `--fast-math` in ldc but it didn't make any 
>>> difference the documentation of `--fast` in Chapel says 
>>> "Disable checks; optimize/specialize".
>> 
>> Just tried removing the boundscheck and got 1.5 seconds in D!
>> 
>
> Congrats! it looks like the thriller!
> What about cpu usage? the same 40%?

CPU usage now revs up almost has time to touch 100% before the 
process is finished! Interestingly using `--boundscheck=off` 
without `--ffast-math` gives a timing of around 4 seconds and, 
whereas using `--ffast-math` without `--boundscheck=off` made no 
difference, having both gives us the 1.5 seconds. As Jacob 
Carlborg suggested I tried adding `-mcpu=native -flto=full 
-defaultlib=phobos2-ldc-lto,druntime-ldc-lto` but I didn't see 
any difference.

Current Julia time is still around 35 seconds even when using 
@inbounds @simd, and running julia -O3 --check-bounds=no but I'll 
probably need to run the code by the Julia community to see 
whether it can be further optimized but it's pretty interesting 
to see D so far in front. Interesting when I attempt to switch 
off the garbage collector in Julia, the process gets killed 
because my computer runs out of memory (I have over 26 GB of 
memory free) whereas in D the memory I'm using barely registers 
(max 300MB) - it uses even less than Chapel (max 500MB) - which 
doesn't use much at all. It's exactly the same computation, D and 
Julia's timing were similar before the GC optimization and 
compiler flag magic in D.


More information about the Digitalmars-d-learn mailing list