marekszpak

95 Reputation

5 Badges

10 years, 13 days

MaplePrimes Activity


These are questions asked by marekszpak

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 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.

In Mathematica I've a function which allows me to send a mail. I use it when I run some long time computations and I want to get an information that they are finished, etc. Is there any way to do the same thing in maple?

 

 

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?

Hi!

In Mathematica 10.0 were introduced regions with functions like TransformedRegion, ReginIntersection, etc. Moreover, it is easy to check if a point is inside a region, etc.

I would like to ask if in Maple I could use some API with similar functionality?. For instance, I would like to get integer points which lay inside an intersection of two cubes. How I could do this in Maple?

 

 

1 2 3 4 Page 2 of 4