hermann on Thu, 19 Sep 2024 20:39:17 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: concurrent computation of a function |
On 2024-09-19 19:53, Bill Allombert wrote:
That is cool, I played a bit and saw that sometimes two entries might occur:The less ugly I could come up with is with using the fairly useless seriesprecision: fun(N)= { while(1, if(default(seriesprecision)>16,return(0)); /*check signal */ if(random(2^16)==0, /*Finish! */ default(seriesprecision,17); /* signal other threads to stop */ return(N))) } default(seriesprecision,16);parapply(fun,[1..20]) %5 = [0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] Cheers, Bill.
? default(seriesprecision,16);parapply(fun,[1..20]) %23 = [0, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ? Regards, Hermann.