pake

15 Reputation

One Badge

8 years, 48 days

MaplePrimes Activity


These are replies submitted by pake

@Bart 

I have now tried short and long tasks on the three operating systems. The observations are as follows:

Long tasks run equally long on all operating systems within and outside the Task module. As you suggested.

Short tasks take longer to run when using the Task module on Windows, but take the same time when run on the Mac or Linux versions of Maple.

I am not sure why this is the case, but I will try to use longer tasks if I run my code on a Windows version.

@Bart 

Yes. Thanks for the suggestion. See attachment. This is run on a mac. I also tried Linux, where it runs as expected as well. Only the Windows version seems to have an issue with the Task module, though I'm still trying some things out.

 


 

NULL

restart

addproc := proc (k) local i, A; A := 0; A := add(i+k, i = 1 .. 100000); return A end proc

ts := time[real](); for t to 1000 do addproc(t) end do; TA := time[real]()-ts

ts := time[real](); for t to 1000 do Threads:-Task:-Start(null, Task = [addproc, t]) end do; TS := time[real]()-ts

ts := time[real](); for t to 1000 do Threads:-Task:-Start(null, Tasks = [addproc, [t, t+1, t+2, t+3]]) end do; TM := time[real]()-ts

TA; TS; TM

7.287

 

7.364

 

7.645

(1)

TM/TA

1.049128585

(2)

``

``

 

CycleTimes:=Array(1..1000):

``


 

Download TaskExample2.mw

In follow up to my topic. I run the script in different computers to see if there was any difference and there is!

On a mac, the tasks took roughly the same time, which is the expected behaviour.

I tried on different versions of windows (and different versions of Maple 2017) and the slow down persisted.

I will be trying Linux next.

Any input as to what could be causing this is welcome!

NULL

restart

addproc := proc () local i, A; A := 0; A := add(i, i = 1 .. 1000); return A end proc

ts := time[real](); for t to 1000 do addproc() end do; TA := time[real]()-ts

ts := time[real](); for t to 1000 do Threads:-Task:-Start(null, Task = addproc) end do; TS := time[real]()-ts

ts := time[real](); for t to 1000 do Threads:-Task:-Start(null, Tasks = [addproc, addproc, addproc, addproc]) end do; TM := time[real]()-ts

TA; TS; TM

0.44e-1

 

0.49e-1

 

0.57e-1

(1)

TM/TA

1.295454545

(2)

 

CycleTimes:=Array(1..1000):

``


 

Download TaskExample.mw

@Bart

I don't think the size of the task is relevant. It should take roughly the same if executed inside or outside the Task module (when executing only one task).

@Christopher2222 

As I feared, once the size of the pool of samples is greater than 100, the probability of having a correlated pool is so small, that the computation doesn't converge (or maybe it does after a few hours), but if I increase the pool size even more, this method does not really work :(

@Christopher2222 

Using while to create a pool of correlated samples looks like a great idea! I wonder how efficient it will if I need to have 2500 correlated samples. I will give this a try and let you know. Thank you very much!

@Markiyan Hirnyk 

Thanks for your answer. Though this makes me think that there is no easy way to do this in Maple.

What if I have to sample an expression containing 10 random variables from various distribution types with different correlation coefficients among them? The method you describe is not feasible.

Page 1 of 1