Re: Simplest multithreading example

2017-09-05 Thread ag0aep6g via Digitalmars-d-learn
On 09/05/2017 03:15 AM, Brian wrote: Thanks very much for your help, I finally had time to try your suggestions. The initial example you showed does indeed have the same problem of not iterating over all values : double [] hugeCalc(int i){ // Code that takes a long time import

Re: Simplest multithreading example

2017-09-04 Thread Brian via Digitalmars-d-learn
On Friday, 1 September 2017 at 20:02:23 UTC, ag0aep6g wrote: On 09/01/2017 07:27 AM, Brian wrote: double [] hugeCalc(int i){ // Code that takes a long time } so if I do double[][int] _hugeCalcCache; foreach(i ; I) _hugeCalcCache[i] = hugeCalc(i); of course the required time is I.len

Re: Simplest multithreading example

2017-09-01 Thread ag0aep6g via Digitalmars-d-learn
On 09/01/2017 07:27 AM, Brian wrote: double [] hugeCalc(int i){ // Code that takes a long time } so if I do double[][int] _hugeCalcCache; foreach(i ; I) _hugeCalcCache[i] = hugeCalc(i); of course the required time is I.length * (a long time), so I wanted to shorten this by splitting

Re: Simplest multithreading example

2017-09-01 Thread Ali Çehreli via Digitalmars-d-learn
On 08/31/2017 10:27 PM, Brian wrote: > the 'real' problem is trying > to split a huge calculation to different threads. I still think you can take advantage of std.parallelism: https://dlang.org/phobos/std_parallelism.html Unfortunately, its features like asyncBuf, map, and amap do not stand

Re: Simplest multithreading example

2017-08-31 Thread Brian via Digitalmars-d-learn
On Friday, 1 September 2017 at 04:43:29 UTC, Ali Çehreli wrote: On 08/31/2017 06:59 PM, Brian wrote: > Hello, I am trying to get the most trivial example of multithreading > working, but can't seem to figure it out. > I want to split a task across threads, and wait for all those tasks to > finish

Re: Simplest multithreading example

2017-08-31 Thread Ali Çehreli via Digitalmars-d-learn
On 08/31/2017 06:59 PM, Brian wrote: > Hello, I am trying to get the most trivial example of multithreading > working, but can't seem to figure it out. > I want to split a task across threads, and wait for all those tasks to > finish before moving to the next line of code. > > The following 2 atte

Re: Simplest multithreading example

2017-08-31 Thread Michael Coulombe via Digitalmars-d-learn
On Friday, 1 September 2017 at 01:59:07 UTC, Brian wrote: Hello, I am trying to get the most trivial example of multithreading working, but can't seem to figure it out. I want to split a task across threads, and wait for all those tasks to finish before moving to the next line of code. The fol

Simplest multithreading example

2017-08-31 Thread Brian via Digitalmars-d-learn
Hello, I am trying to get the most trivial example of multithreading working, but can't seem to figure it out. I want to split a task across threads, and wait for all those tasks to finish before moving to the next line of code. The following 2 attempts have failed : --