395 Reputation

6 Badges

7 years, 100 days

MaplePrimes Activity

These are replies submitted by emendes

@Joe Riel Many thanks.   How about the use of  any Grid procedure ( in a user made procedure) within a module.  Can it be done?  And how?  As said I have tried to do it but without success.  

@Joe Riel Many thanks.  I tested your solution on a large set and works just fine.   

Why don't I need to issue Grid:-Set(CleanExpr,'coefmodel') in this case?   I thought I had to issue Grid-Set for all new procedures and variables used in them.  I use Grid:-Map extensively and if I am not careful to define all procedures and variables using Grid:-Set, Maple complains and aborts the calculations.   

I have also tried to put all Grid:-Map procedures in a module but Maple complains as if I didn't issue Grid:-Set at all (I tried to place Grid:-Set inside and outside of the module but to no avail).   

In what follows the first set of  " ... should like to see" is copied from the one sent last year.  

My wish has to do with Grid and Threads packages:

1) Efficient usage of memory -   Once a grid command finishes the memory allocated should return to Maple (I am not sure whether this is possible or not). There is a post in the list showing that, in some calculations using Grid, Maple hangs for no apparent reason.

2) A clear explanation in the help files (examples) on which variables should be Grid:-Set and which don't.  (Although I have received help from top users on the list and from maple support, the answers are not the same in some cases).

3) CodeTools:-ThreadSafetyCheck - Some of the functions that are threadsafe checked by this command cause Maple to hang.  Is the list of threadsafe functions updated?  


1) Once the time to finish is set, maple will terminate the operation no matter what.

@acer Thank you.   I don't know how I miss that but I did.  No excuse.   

@Rouben Rostamian  No problem.  Thanks for the help.

@Carl Love Many thanks.  Below is a piece of code without alias that sends out a result.  It is not elegant, does not use the Physics package (the notation is beyond my understanding)  and the result is not in the form I want (z2=Grad(F_1).F).


             F := [f1(x(t), y(t)), f2(x(t), y(t))]

                phi := [x(t), phi1(x(t), y(t))]

        [ d                          d                       ]
 sys := [--- x(t) = f1(x(t), y(t)), --- y(t) = f2(x(t), y(t))]
        [ dt                         dt                      ]

                          [ d         d      ]
                  vars := [--- x(t), --- y(t)]
                          [ dt        dt     ]

                   --- x(t) = f1(x(t), y(t))

                   --- y(t) = f2(x(t), y(t))

        ---- x(t) = D[1](f1)(x(t), y(t)) f1(x(t), y(t))

           + D[2](f1)(x(t), y(t)) f2(x(t), y(t))

        ---- y(t) = D[1](f2)(x(t), y(t)) f1(x(t), y(t))

           + D[2](f2)(x(t), y(t)) f2(x(t), y(t))

z__1:=rhs(s1[1]);   #  d(Lf(x))/dt = F[1]   
z__2:=rhs(s2[1]);   #  d(Lf(Lf(x)))/dt = Grad(F[1]).F
                     z__1 := f1(x(t), y(t))

          z__2 := D[1](f1)(x(t), y(t)) f1(x(t), y(t))

             + D[2](f1)(x(t), y(t)) f2(x(t), y(t))


@Rouben Rostamian  Many thanks for the quick answer. 


I need further help to understand how the package works.  In the example below (pseudocode) I did all the calculations by going back or forward to avoid the time dependence and I wonder whether the Physics package will do the same elegantly. 

newsys:=subs({x=phi[1],y=phi[2]},sys);  # A transformation of Coordinates - Can we use the Physics package here?
# And another transformation of coordinates
z__2   # Lf(z__1) - Lie derivative of z__1 in f
z__3  # Lf(z__2) 

Many thanks


@Carl Love and @mmcdara Many thanks.   

@Carl Love I remember reading in one of your answers only one of the time outputs of Usage matters when using Grid or Threads but I don't remember which one.  Could you remind me?

I did not have time to run a memory demanding example but a small (not that small) example showed me that Carl's solution is blazing fast.   

@Carl Love Since your solution is very concise, could you be so kind to open it up to show the details (curry, splitranks,..)?  




@Carl Love Many thanks.   Before reading your reply I tried exactly what you suggested (first option) and it worked.   

@tomleslie Many thanks.   Grid:-Set(UtilsIORelation) did the trick for removing the error message.  Now I have to check how to deal with the other issues.  

@Carl Love Many thanks.  I have just sent you an email with a link to the file with only two variables (parms10 and parms11).  

The Grid version of my procedure is running so far without any problem.   I hope Grid does not choke (as it does in other calculations for no reason).  


@Carl Love Many thanks.  Yes, "kernel panic" meant "maple: fatal error, lost connection to kernel". 

By changing the line, I got a different message - "Execution stopped: Stack limit reached."  - The limit was changed but the same msg came out.  kernelopts adjustments made no difference.  


@Carl Love Many thanks.  I am using Maple 2020.2 on both machines:  the server and the MacBook pro.  I sent the examples from the MacBook pro because I was running a much larger example on the server using your code without any modification (my attempt to modify your not-threaded code is not worth spending time). The outcome was "kernel panic". 

parse/sprintf were used to select the examples without having to modify the worksheet (I use batch files to run mpl files). As you know I had to save the intermediate results in files due to the size of the computations.  

As I said the use of the threaded version ended up with a kernel panic on the server.   

ProbSize: [[1122436, 1639162], [11224360, 17995320], [29, 29]]

@Carl Love Many thanks.  Here are the results for a less computationally demanding case.    SubsetPairsSparse2 is a procedure with the last line changed to [Threads:-Seq](`intersect`(seq(T[x], x= a)),a in A).




1) Why does Maple return numcpus when kernelopts is called for the first time?

2) Why does Maple return 2 instead of 4 in some of the subsequent calls of kernelopts?  

@Carl Love The result of issuing the command shown above and running SubsetPairsSparse is

memory used=16.37GiB, alloc change=0 bytes, cpu time=5.53h, real time=25.90m, gc time=5.48h

There is certainly an improvement over the last calculation but did not reach 17 minutes when using Grid (as I said Grid is not a good option because I don't know when it is going to hang for no reason and memory demand).  

1 2 3 4 5 6 7 Last Page 2 of 18