Question: Grid:-Map no speed up

I have a complicated function that I call on a elements of a list. This function inside calls various other functions and in particular fsolve, which is not thread safe. In order to speed things up I tried using Grid:-Map, but have found a slight drop in performance.

So say a run with map takes 31 seconds, a run with Grid:-Map will take 32 seconds. By looking at the cpu activity, I can tell that only a single core is used at any one time (this is also evident from timing). By looking at the processes, I do see "mserver -gridnode 1/4", etc. present however, so new mserves are certainly spawned - they are just just not used concurrently.

Grid:-NumNodes() gives 4 for my CPU.

Any ideas how to force my code to run on all four nodes??

I am on ubuntu 12.04 x86_64.

thanks.

 ** EDIT **

In case someone finds this useful. Here is a quick-hack that fixes this problem for me.

Look at the current implementation of Grid:-Map with

showstat(Grid:-Map):

Define a new function called say hackMap that is identical to Grid:-Map, except, change the second line from this

     var := `union`(`union`(map(proc (x) op(0,x) end proc,indets(f,function)),indets(f,name)),{'`grid/mapcmd`'});

to this:

     var := {anames('user'), '`grid/mapcmd`'};

now use hackMap as you would Grid:-Map.

It basically forces maple to copy all the 'user' variables over to the new processes. On a machine with 4 nodes i get a ~4 seedup with my particular code.

NOTE: I am not certain that there aren't some side effects as I dont' know all the code behind the scenes, but I seem to get correct results with my particular code.

Please Wait...