Items tagged with grid

Feed
with(plots):
with(Grid):

HeatPC := proc (f, g, n, lambda, N, T)
 local k, u, i, L,fcoef;
 fcoef := proc (y) options operator, arrow; sqrt(2)*sin(lambda*y) end proc;
 u := proc (y, t) options operator, arrow; sum((int(fcoef(x)*g, x = 0 .. 1, numeric))*exp(-k*lambda*t)+exp(-k*lambda*t)*(int(exp(k*lambda*s)*(int(f, x = 0 .. 1, numeric)), s = 0 .. t, numeric)), k = 1 .. n) end proc;
 L := [Grid[Seq](plot(u(x, (i*T-T)/N), x = 0 .. 1, color = COLOR(HUE, i/N), legend = typeset((i*T-T)/N, "s")), i = 1 .. N)]; 
return u(1, 1), display(L, legendstyle = [location = right])
 end proc;

h := piecewise(x <= 0, 0, 0 < x and x < 1, 3, x >= 1, 0)

HeatPC(1, h, 100, Pi, 10, 1.5)

I'm trying to use the above procedure to plot graphs for different inputs. To make the code easier on the eye I want to split my main function u into several smaller functions. To that end I added the function fcoef. Now when I try to run the procedure for simple input values I get the error "Warning, expecting only range variable x in expression 100.*int(fcoef(x)*piecewise(x <= 0.,0.,0. < x and x < 1.,1.,1. <= x,0.),x = 0. .. 1.) to be plotted but found name fcoef". However u still evaluates nicely at (1,1) so obviously my function fcoef is well defined. How do I go about getting plot to recognize this?

 

 

Hello

I have a procedure that builds an ideal from a specific set of polynomials and then calls the Groebner basis package to eliminate some of the variables.  Even though the procedure is running on a machine with 2 processors, 24 cores and 72 GB of ram, only one core has been used (and is always on a 100% usage).  Would the Grid Computing Toolbox be of some hope in this case?  If so,  how to insert the Grid commands so that Maple sends the calculations to the other cores (I find the document rather confusing)?   If I am talking non sense,  please let me know.

Many thanks

Ed

 

 

 

Hi, 

I'm solving a 2D grid with some finite-diference methods. The result is a surface, i.e f(x,y) = z. Where X and Y and points on a grid. 

 

I then need to integrate over this grid, i.e

int(f(x,y),[x=0..10, y=0..10]) 

I have tried interpolating the grid. I've used CurveFitting:-ArrayInterpolation() to interpolate points in this 2D space and then integrate over them. 

I'm using a 30x30 grid, but this interpolation scheme takes far too long. The function generated from the ArrayInterpolation creates an interpolation every time a point is evaluated, which I assume is why the integral is very computationally expensive. 

I would like to create a piecewise analytic function from the 2-D grid, perhaps using CurveFitting:-Spline(), however from my understanding this only works for 1D objects? 

Is there any better solution for integrating a 2D numeric grid?

Thanks in advance

Hi everyone,

For my first question, I am looking for some help about the following. I have the opportunity to run a worksheet in parallel on a cluster of sixteen workstations, each one endowed with twelve CPUs, through the GRID Computing Toolbox. However, I have troubles concerning how to do that.

I join the worksheet at issue: abmm_ma_1.mw The aim is to run large-scale numerical simulations of a dynamic system, depending on the values given to the initial conditions and to the parameters. The worksheet is organized in four execution groups:

  1. The required packages (combinat and LinearAlgebra).
  2. Calibration of the parameters and initial conditions.
  3. The system, which is embedded into a procedure called SIM.
  4. The activation of SIM, whose outputs are nine .mla files, each one being made of a real-number matrix.

The truth is, I do not clearly see how to modify the worksheet with some elements of the GRID package. Besides, the cluster operates under HTCondor so that running the worksheet requires beforehand the creation of a .sub file. This should be done in consistency with the aforesaid modification.

Any help is welcome, thanks a lot.

 Hi everybody,

Until recently I was using Maple 2015.0 on this PC :

Windows XP
2 dual core proc Intel(R) Xeon(R) CPU E3-1225 V2 ; 3.19 GHz
64 bytes,
16 Go RAM

For two days now I am using Maple 2015.0 on this one

Windows 7
4 dual core proc Intel(R) Xeon(R) CPU 5-2637 V3 ; 3.50 GHz
64 bytes,
64 Go RAM


Comparisons of the running times for exactly the same code, consisting in 10000 independent Monte Carlo  simulations distributed over all the nodes (resp 4 and 8) give :

Windows XP :  504 sec  (with a variation of the order of  +/- 3s for different replicates)

Windows 7   :  343 sec  (with a variation of the order of  +/- 3s for different replicates)


The expected running time should be 504 * (3.2/3.5) * (4/8) = 230 s
(or 504 * (4/8) = 252 s if you neglect the acceleration due to the clock rate)
The realized running time (343 s) is thus at least  40% larger than the expected one.


Does anybody has already observed this kind of performance loss during XP -> 7 migration ?
Are there some comparisons of cpu times between Windows XP and 7 ?


Thank you all for sharing your own experience.



postscript : a NOTIONALexample of how the computations are distributed is given below

NbOfRuns := 10000:

# Data is a Matix(NbOfRuns, NbOfCols, …) constructed elsewhere

NbOfNodes := Grid:-NumNodes():
NbOfRunsPerNode := NbOfRuns / NbOfNodes:
for k from 0 to NbOfNodes do
   FirstData := 1 + k * NbOfRunsPerNode:
   LastData := (k+1) * NbOfRunsPerNode:
   Grid:-Run(k+1, MyCode, [Data[FirstData..LastData, ..], …])
end do:

I'm currently working on building a Grid Layout for a project, and I'm having trouble coding in the RunWindow and GetFile elements into buttons under the grid layout. I've gone through the overviews and examples for them, but had no luck. I'm using Maple 2016.1 for OS X.

Additionally, the structure of the code is slightly different as to how many of the example worksheets structure their Grid Layout code, since the code originated from a Maplet Builder file. I.e. in the example worksheets they would follow as:

maplet := Maplet('onstartup' = 'Action1', 'reference' = 'Maplet1',
         BoxLayout('background' = "#D6D3CE", 'border' = 'false', 'halign' = 'center', 'inset' = '5', 'reference' = 'BoxLayout1', 'valign' = 'center', 'vertical' = 'false', 'visible' = 'true',
                       BoxColumn( BoxCell('hscroll' = 'never', 'value' = 'Button1', 'vscroll' = 'never'),
         GridLayout('background' = "#D6D3CE", 'border' = 'false','halign'='center','inset'='5', 'reference' = 'GridLayout1', 'valign' = 'center', 'visible' = 'true',
                   GridRow('valign' = 'top', GridCell('height' = '1', 'hscroll' = 'never', 'value' = 'BoxLayout1', 'vscroll' = 'never', 'width' = '1' ))),
         Window('layout'= 'GridLayout1', 'reference' = 'W1', 'resizable' = 'true', 'title' = "Maplet"),
          Action('reference' = 'Action1', RunWindow('window'= 'W1'))

However the structure for the code I am working with has action at the very start of the code, follwed by the the code for the buttons then layouts/window.  E.g. (the code has been shortened)

with (Maplets[Elements]):
maplet :=
Maplet('onstartup'='Action1','reference'='Maplet1',
Action('reference'='clickButton1'),
Action('reference'='clickButton9',
Evaluate('function'='plot3d(x^2*cos(y),x = -1 .. 1,y = -2*Pi .. 2*Pi)','target'='Plotter1','waitforresult'='true')),
Action('reference'='clickButton11'),
Action('reference'='clickButton12'),
Action('reference'='clickButton10'),
Button('background'="#D6D3CE",'caption'="Insert Molecular Geometry",'enabled'='true','foreground'="#000000",'onclick'='clickButton1','reference'='Button1','visible'='true'),

....

BoxLayout('background'="#D6D3CE",'border'='false','halign'='center','inset'='5','reference'='BoxLayout1','valign'='center','vertical'='false','visible'='true',
BoxColumn(
BoxCell('hscroll'='never','value'='Button1','vscroll'='never'),
BoxCell('hscroll'='never','value'='BoxLayout2','vscroll'='never'),
BoxCell('hscroll'='never','value'='BoxLayout3','vscroll'='never'),
BoxCell('hscroll'='never','value'='BoxLayout9','vscroll'='never'),
BoxCell('hscroll'='never','value'='BoxLayout14','vscroll'='never')),
BoxColumn(
BoxCell('hscroll'='never','value'='Label3','vscroll'='never'),
BoxCell('hscroll'='never','value'='Plotter1','vscroll'='never'),
BoxCell('hscroll'='never','value'='Slider1','vscroll'='never'))),
GridLayout('background'="#D6D3CE",'border'='false','halign'='center','inset'='5','reference'='GridLayout1','valign'='center','visible'='true',
GridRow('valign'='top',
GridCell('height'='1','hscroll'='never','value'='BoxLayout1','vscroll'='never','width'='1'))),
Window('layout'='GridLayout1','reference'='Window1','resizable'='true','title'="Maplet"),
Action('reference'='Action1',
RunWindow('window'='Window1'))):

Maplets[Display](maplet);

 

If anyone would be able to provide an example of code or some guidance I could follow that would be greatly appreciated! 

Hi all,

I start working with the Grid package.
To familiarize myself with it I ran the "primeChecker" example, which of course has worked perfectly well.

Next I did this (a priori harmless) simple modifications :

  1. within the primeChecker procedure :
    replace  myVal := userData[thisNode+1] :
    by         myVal := userData[thisNode+1, 1] :
  2. before launching the procedure with Grid[Launch] :
    replace  userData := [ .... ] :  #which is a list
    by         userData := [ .... ] :  # the same thing
                 userData := convert(userData, matrix): 


I get the following error message :
error, (in unknown) Matrix index out of range


What does it mean and how can I fix this ?

Thanks in advance

This is somehow an old problem which came back and I decided to post it. So, I have some code which runs in Grid framework locally. Each node saves data directly to hard disk and there is no need to return anything at the end to the node of ID 0. Nevertheless, I noticed that memory usage on one instance of the mserver is very huge.  Moreover, this instance is all the time in S state, namely sleeping. Below you can see dump from top. I deny this is caused by some particular procedures called in my code since in this case I should rather observe more uniform memory usage. I am not sure if for this moment I could share some code with you which demonstrate this behavior. I will try to write some toy example because my productive code cannot be posted here.

%MEM     TIME+ COMMAND

49.1 17:00.19 mserver
0.1 12:43.70 mserver
0.1 12:32.15 mserver
0.1 13:54.02 mserver
0.1 14:45.45 mserver
0.1 12:35.22 mserver
0.1 13:50.77 mserver
0.1 14:14.85 mserver
0.1 8:58.82 mserver
0.1 12:58.48 mserver
0.1 8:51.00 mserver
0.1 10:35.92 mserver
0.1 12:58.13 mserver
0.1 9:34.39 mserver
0.1 10:10.13 mserver
0.1 12:07.77 mserver
0.0 8:21.17 mserver
0.0 11:41.42 mserver
0.0 5:07.27 mserver
0.0 8:31.88 mserver
0.0 6:30.12 mserver

I am interested in efficiently plotting a grid of squares where each square is coloured. 

 

From what I understand I can do this using plotting primitives. For example,

P1 := Array( 1..4, 1..2, [[0,0],[1,0],[1,1],[0,1]],storage=rectangular, order=C_order, datatype=float[8] );

P2 := Array( 1..4, 1..2, [[1,1],[2,1],[2,2],[1,2]],storage=rectangular, order=C_order, datatype=float[8] );

PLOT( POLYGONS(P1,P2), COLOUR(RGB,1,0,0,0,1,0)  );

plots one red and one green unit sqaure.

 

I am interested however in plotting millions of squares.  Is there a way to efficiently store the sequence required for the POLYGONS and COLOUR primitive?  Ideally I want to store them as arrays.

I am faced by the problem where I used Grid:-Seq()---locally---to do some long time computation and I am faced by the exhaustion of memory problem. I think the problem itself is related to the memory management in maple.

So the problematic function is

# Procedure: ComputeEventsCTypeGrid
#   Compute events such that three quadrics intersects in a point.
#
# Parameters:
#   Q          - a set of quadrics
#
# Output:
#   Indexes of quadrics which intersect in a point.
# TODO:
#  - Memory
#  - Cleanups
ComputeEventsCTypeGrid := proc( Q )
  local s, cType, i, j, k, rootNb, univ, sys;
  s := proc (i, j, k)
    sys := [ Q[i], Q[j], Q[k] ];
    univ := PolynomialIdeals[UnivariatePolynomial]( indets( sys )[1], sys );
    if not type( univ, constant ) then
      rootNb := nops(select(proc(x)op(x)[2]>0;end proc,RootFinding:-Isolate( univ, [ op( indets(univ ) ) ] )) ):
      if rootNb > 0 then
        return [ univ, rootNb, sys ];
      end if:
    end if:
  end proc;
  cType := [Grid:-Seq(seq(seq(s(i,j,k),k=j+1..nops(Q)),j=i+1..nops(Q)),i=1..nops(Q))];
  return cType;
end proc:

A dump from top after calling ComputeEventsCTypeGrid for some data(total amount of memory on this machine is 251G + 48G swap)

VIRT    RES    SHR S  %CPU %MEM     TIME+

33.007g 0.031t   3676 S   0.0 12.5   2606:20
31.137g 0.029t   3436 S   0.0 11.7   2274:34
8645756 4.984g   2840 S   0.0  2.0  32:06.40
28.798g 0.026t   1968 S   0.0 10.7   1821:16
26.650g 0.024t   1968 S   0.0  9.8   1520:54
25.346g 0.023t   1968 S   0.0  9.2   1236:44
23.296g 0.021t   1968 S   0.0  8.4   1004:52
20.498g 0.018t   1968 S   0.0  7.4 790:30.81
16.799g 0.014t   1968 S   0.0  5.9 625:28.12
15.011g 0.013t   1968 S   0.0  5.2 469:36.27
7678444 4.149g   1968 S   0.0  1.6 104:34.22
6734804 623904   1968 S   0.0  0.2  73:13.13
4327420 132516   1968 S   0.0  0.1  24:11.51
3420712 111336   1968 S   0.0  0.0  11:26.16
13.671g 0.011t   1964 S   0.0  4.6 380:15.13
11.771g 9.831g   1964 S   0.0  3.9 274:25.59
9936056 7.769g   1964 S   0.0  3.1 201:13.94
8805512 3.394g   1964 S   0.0  1.3 148:09.53
5077056 1.500g   1964 S   0.0  0.6  42:19.29
2384784  82040   1832 S   0.0  0.0   3:56.57

Size of output data calculated with

> length(sprintf("%m", eval(cType)));

> 326260610

Also, I called gc() at the end of the computations but memory allocated by instances of mserver were not released. Does it mean gc() should be called from each instance separately? My final point is that I have to run some other calculations for different and bigger dataset (It will probably take 2 days to finish -- Q has around 700 polynomials of degree 2) and for this moment I cannot do this because I've gotten an error about not enough amount of memory.

Hi!I am running some grid computations and I found that I could speed up my computations if my nodes could share some partial results. It seems that Grid:-Send and Grid:-Receive is almost perfect. The problem is that Grid:-Receive blocks the computations where I cannot ensure that a message will ever be send. I've tried to run Grid:-Receive on a thread in an possible infinite loop but it still blocks.

Some pieces of code below:

SignatureReciever:=proc(SigContainer::uneval,stopValue::uneval)
  while eval(stopValue) do
    SigContainer := eval(SigContainer) union {convert(Grid:-Receive(),string)};
  end do;
end proc:

SendMessage:=proc(message::string, id::integer)
  Threads[Seq](proc(i) if i <> id then Grid:-Send(i,message) end if end proc,i=0..Grid:-NumNodes()-1);
end proc:

In the main procedure run on a node I have

Threads:-Create(SignatureReciever('Signatures','stopValue'));

....

....

SendMessage(signature,id);

....

....

stopValue := false;

 

Do you have any suggestions how to solve my problem?

What is the correct mode of using dsolve/numeric/compile with Grid package?

I've tried a lot of different, but only one turned out to be working is by using Grid:-Seq(dsolve..., i=1).

For example:

...

dsol := Grid:-Seq(dsolve(dsys, numeric, parameters = [bb, qq, prf0, `p&theta;f0`], compile = true, optimize = true, output = listprocedure, maxfun = 0), i = 1):

dsol3 := proc (tt) try dsol[3](tt) catch "cannot evaluate the solution further": tt = 0. end try end proc:

st := time[real]():

A := Array([Grid:-Seq([seq(op(2, [dsol[1](parameters = [b[i, j], q[i, j], pr[i, j], `p&theta;`[i, j]]), rhs(dsol3(-10^6))]), j = 1 .. sz[2])], i = 1 .. sz[1])]);

time[real]()-st;

example.mw

But this mode not stable and causing to this error very often:

Error, (in dsolve/numeric/SC/preproc) unable to post-link (rc=31), please try again, and if that fails check that your Windows SDK installation is up to date, and compatible with your Windows compiler

How I can fix this problem?

Has there been any progress with new commands for Maple 13 that allow one to auto-resize the plotting grid?

I am generating fractals with Maple 13 and resizing the plot output grid manually is not an option because it distorts it. Neither is the option to resize it once and recalculate, because the final grid contains many points.

Any pre-processing or massaging code prior to executing the main code is very welcome (if it can be done).

Many thanks,

Yiannis

Code was computed on two different PC:
1) Win 8.1, Maple 17.02 x64
2) Win 8.1, Maple 18.01 x64

In brief:

n:=3: 
Grid:-Seq('f(i)', i = 1 .. n):

works well in Maple 17.02 but gives an error in Maple 18.01. Why?

However,

(j -> Grid:-Seq('f(i)', i = 1 .. j))(n):

works well for both Maple versions.

according to examples from Maple help page
http://www.maplesoft.com/support/help/Maple/view.aspx?path=Grid%2fSeq
we have to pass exactly 'f(i)' (not just f(i)) into Grid:-Seq(...). Why?

Why doesn't Digits:=30: work properly for Grid:-Seq(...)?

For details see attached file. Output was produced in Maple 17.02. In Maple 18.01 the output will differ.


restart; n := 3; f1 := proc (i) options operator, arrow; evalf(sqrt(i)) end proc; f2 := proc (i) options operator, arrow; evalf(sqrt(i+1)) end proc; f3 := proc (i) options operator, arrow; evalf(i*Pi) end proc; g1 := proc (f, n) local za, zb, zc, str; str := sprintf("g1(%a,n)", f); za := seq(f(i), i = 1 .. n); zb := Grid:-Seq(f(i), i = 1 .. n); zc := (proc (j) options operator, arrow; Grid:-Seq(f(i), i = 1 .. j) end proc)(n); print("------------------------------"); print(cat("(a):   ", str), za); print(cat("(b):   ", str), zb); print(cat("(c):   ", str), zc); print("------------------------------") end proc; g2 := proc (f, n) local za, zb, zc, str; str := sprintf("g2(%a,n)", f); za := seq('f(i)', i = 1 .. n); zb := Grid:-Seq('f(i)', i = 1 .. n); zc := (proc (j) options operator, arrow; Grid:-Seq('f(i)', i = 1 .. j) end proc)(n); print("------------------------------"); print(cat("(a):   ", str), za); print(cat("(b):   ", str), zb); print(cat("(c):   ", str), zc); print("------------------------------") end proc

3

(1)

g1(f1, n);

"------------------------------"

 

"(a):   g1(f1,n)", 1., 1.414213562, 1.732050808

 

"(b):   g1(f1,n)", 1, 2^(1/2), 3^(1/2)

 

"(c):   g1(f1,n)", 1, 2^(1/2), 3^(1/2)

 

"------------------------------"

 

"------------------------------"

 

"(a):   g1(f2,n)", 1.414213562, 1.732050808, 2.

 

"(b):   g1(f2,n)", 1.414213562, 1.732050808, 2.000000000

 

"(c):   g1(f2,n)", 1.414213562, 1.732050808, 2.000000000

 

"------------------------------"

 

"------------------------------"

 

"(a):   g1(f3,n)", 3.141592654, 6.283185308, 9.424777962

 

"(b):   g1(f3,n)", 3.141592654, 6.283185308, 9.424777962

 

"(c):   g1(f3,n)", 3.141592654, 6.283185308, 9.424777962

 

"------------------------------"

 

"+++++++++++++++++++++++++++++++++++++++++++"

 

"------------------------------"

 

"(a):   g2(f1,n)", 1., 1.414213562, 1.732050808

 

"(b):   g2(f1,n)", 1., 1.414213562, 1.732050808

 

"(c):   g2(f1,n)", 1., 1.414213562, 1.732050808

 

"------------------------------"

 

"------------------------------"

 

"(a):   g2(f2,n)", 1.414213562, 1.732050808, 2.

 

"(b):   g2(f2,n)", 1.414213562, 1.732050808, 2.

 

"(c):   g2(f2,n)", 1.414213562, 1.732050808, 2.

 

"------------------------------"

 

"------------------------------"

 

"(a):   g2(f3,n)", 3.141592654, 6.283185308, 9.424777962

 

"(b):   g2(f3,n)", 3.141592654, 6.283185308, 9.424777962

 

"(c):   g2(f3,n)", 3.141592654, 6.283185308, 9.424777962

 

"------------------------------"

(2)

Digits := 30;

30

 

"------------------------------"

 

"(a):   g1(f1,n)", 1., 1.41421356237309504880168872421, 1.73205080756887729352744634151

 

"(b):   g1(f1,n)", 1, 2^(1/2), 3^(1/2)

 

"(c):   g1(f1,n)", 1, 2^(1/2), 3^(1/2)

 

"------------------------------"

 

"------------------------------"

 

"(a):   g1(f2,n)", 1.41421356237309504880168872421, 1.73205080756887729352744634151, 2.

 

"(b):   g1(f2,n)", 1.414213562, 1.732050808, 2.000000000

 

"(c):   g1(f2,n)", 1.414213562, 1.732050808, 2.000000000

 

"------------------------------"

 

"------------------------------"

 

"(a):   g1(f3,n)", 3.14159265358979323846264338328, 6.28318530717958647692528676656, 9.42477796076937971538793014984

 

"(b):   g1(f3,n)", 3.14159265358979323846264338328, 6.283185308, 9.424777962

 

"(c):   g1(f3,n)", 3.14159265358979323846264338328, 6.283185308, 9.424777962

 

"------------------------------"

 

"+++++++++++++++++++++++++++++++++++++++++++"

 

"------------------------------"

 

"(a):   g2(f1,n)", 1., 1.41421356237309504880168872421, 1.73205080756887729352744634151

 

"(b):   g2(f1,n)", 1., 1.414213562, 1.732050808

 

"(c):   g2(f1,n)", 1., 1.414213562, 1.732050808

 

"------------------------------"

 

"------------------------------"

 

"(a):   g2(f2,n)", 1.41421356237309504880168872421, 1.73205080756887729352744634151, 2.

 

"(b):   g2(f2,n)", 1.414213562, 1.732050808, 2.

 

"(c):   g2(f2,n)", 1.414213562, 1.732050808, 2.

 

"------------------------------"

 

"------------------------------"

 

"(a):   g2(f3,n)", 3.14159265358979323846264338328, 6.28318530717958647692528676656, 9.42477796076937971538793014984

 

"(b):   g2(f3,n)", 3.141592654, 6.283185308, 9.424777962

 

"(c):   g2(f3,n)", 3.141592654, 6.283185308, 9.424777962

 

"------------------------------"

(3)

``

NULL


Download Grid[Seq].mw

i have a corei7 laptop and i want maple to use all of my cpu cores in paraller,what should i do exactly ? in there anyway to use them without using grid computing toolbox ? or how to manage it with grid computing toolbox? i want maple use all of my cpu power during computation, tnx for help 

another interesting bug in mapleprimes, when i created new tage , i face this error : 

Only users with at least 250 reputation can create new tags, please remove or replace these tags: computing !
i have 305 but i could not do it ! :| .

1 2 Page 1 of 2