Question: Parallel programming using Threads:-

I am (again) trying to get Maple to do some parallel work; using the Threads package.

My actual problem involves a vector function with 6 elements, acting on 6-vectors. Each element of the output vector is calculated as a high-order polynomial of all 6 input elements. The whole thing is a map that I want to iterate. I plan to evaluate each of the 6 functions in a separate thread (the input vector of course is the same for all six) and then put the results together in a Vector, to be used as input for the next iteration.

Facing difficulty I finally wrote myself a little toy program to check out the basic mechanism. Here it is:

restart;
                "Maple Initialization loaded..."
with(Threads):
f:=x -> 1+x^2;
                                       2
                        f := x -> 1 + x
x:=0:
tt:=time[real]():

for i from 1 to 10 do
  id:=Create(f(x),y):
  Wait(id):
  x:=y:
  y:='y':
end do:

time[real]()-tt;
                             0.018
i;
                               11
So far so good; even the output (not shown) makes sense. BUT: as I increase the number of iterations in the for...do loop, the memory allocation goes up fast, and I hit a point at about 40 iterations where the whole process locks up and the program never ends, cannot even be stopped (at least for 100 iterations), forcing me to abort the whole thing. I have evidence that Maple allocates vast amounts of memory which finally chokes the whole thing (on a 16 GB-RAM machine).

Anyone have any idea what I am doing wrong? I realize the above example does not provide benefits; in the real example there will be 6 Creates and the loop will Wait for all of these to finish.

I'd really like to get this to work as each function can take quite some time and I do expect at least some speed-up from parallelizing this (even after overhead).

This is on Maple 2015 on Mac OS X 10.10.5 with 16 GB of RAM. I should mention that I set UseHardwareFlots:=true in my .mapleinit file.

Thanks,

M.D.

Please Wait...