emendes

225 Reputation

6 Badges

3 years, 322 days

MaplePrimes Activity


These are questions asked by emendes

Hello

I had to save previous results of a calculation to files as the number of elements is too big for my computer to handle in one go.   Here it is an idea of what I am doing to read the files and perform the calculations.

mainproc:=proc(arg1,arg2,arg3,arg4) ... end proc:

Grid:-Set(mainproc):
Grid:-Set(arg2,arg3,arg4):   #  They don't change ever.

for i from 1 to number_of_files do 
   read(...):  # it reads arg1 from a file
   Grid:-Set(arg1):
   ans:=Grid:-Seq(mainproc(arg1[i],arg2,arg3,arg4),i=1..numelems(arg1))):
   Grid:-Wait():
   save ans, ....:
   unassign('arg1'):
   unassign('ans'):
   gc():  # An attempt
end do:

The actual code works but, for every step in the loop, the memory used by Maple increases by a certain amount that seems to be mostly related to arg1 (as if arg1 is piling up from iteration to iteration). 

I read some of the earlier posts on a similar subject dated 5 to 10 years old.  I wonder if there is something new that can be done to minimize the usage of memory.   

Many thanks

Ed

 

PS. I am aware of tasksize, numcpus and Threads.   

 

 

 

Hello

Maple is dangerously close to using all available memory on my Linux machine by doing a calculation using  Grid:-Seq (Map, ..).   Is there a way to control the amount of memory used? Is numcpus a good option?   Or tasksize? 

I expect that Maple will use a large amount of memory since the calculations are performed over a rather large list of sets.  

Many thanks.

Ed

[Moderator's note: The original version of this Question mentioned using both Grid and Threads. The following 5 Replys will not make sense without knowing that Threads was mentioned.

Ed: Editing your Questions is fine, but please don't remove information that is necessary to understand the Replys and/or Answers that are already posted.--Carl Love]

Hello again

I need to find the position of the elements of one list in another list.  Here it is a simple example

L1:=[837, 526, 283, 216, 93, 512, 161, 202, 76, 851, 503, 437, 147, 36, 922];
L2:=[526, 283, 202, 437, 922, 865, 879, 804, 473, 325];
remove(has,map(x->ListTools:-Search(x,L1),L2),0)

the position of the elements in list L1 is [2, 3, 8, 12, 15].   

For huge lists, this solution is not efficient.  Can that be done faster and less memory demanding? (Threads or Grid safe?).

Many thanks.

Ed

Hello

I have a list with a large number of elements and I need to partition it in chunks of a specific size.  Here is my attempt

listpart := proc(cond::list,nchunk::nonnegint:=1000)
if numelems(cond) < nchunk then
	newcond:=[cond]:
else
	ss:=[`$`(1..numelems(cond))]:
	sss:=map(`mod`,ss,nchunk):
	ind:=[ListTools:-SearchAll(0,sss)]:
	ind:=[0,op(ind),ifelse(ss[numelems(ss)]=ind[numelems(ind)],[],ss[numelems(ss)])]:
	newcond:=[Threads:-Seq(cond[(ind[j]+1)..ind[j+1]],j=1..(numelems(ind)-1))];
end if:
return(newcond):
end proc:

It does not run as fast as I thought.  I am not even sure if Threads:-Seq could be used in this case.  Please tell me what I am doing wrong and how I can modify the code to get a faster response.  

Many thanks

Ed

 

Hello

In Section 14.5 - External Calling ..., page 489, the authors gave an example on how to use the command line in Unix to call maple with arguments. I followed the example but added a mpl-file to see if the arguments were sent to it.  

Example (Linux):

/opt/maple2020/bin/maple -c n:=4 -c 'path:="/home/eduardo/examples";' example.mpl > output.txt &

Maple sends out the following error message: "Error, incorrect syntax in parse: '/' unexpected (near 7th character of parsed string)".

The msg is clear where the error is but I could not figure out what to do. The single quotes were supposed to take care of that, weren't they?  

Many thanks.

Ed

Edit: I have added the double-quotes.   The problem still persists.  

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