serilas

96 Reputation

4 Badges

15 years, 155 days

MaplePrimes Activity


These are questions asked by serilas

Hello, everyone. I have some problem with multithreaded calculation. I just need calculate eigenvalues of matrix m at various parameters (and then export to a file) using advantages of the parallelizing. The following code works but in serial way

 

restart: with(LinearAlgebra):

m:=ImportMatrix(cat(currentdir(),"m.txt")): # here is matrix m.txt

step:=1:

 

prc:=proc(k1,k2)

local u,i,j,nmc:

u:=Matrix(ceil(1+(k2-k1)/step),5):

u[1,1]:=k1:

for i from 2 to op([1,1],u) do

u[i,1]:=u[i-1,1]+step:

end do:

for i from 1 to op([1,1],u) do

nmc:=sort(Eigenvalues(m*u[i,1], output='list')):

for j from 2 to op([1,2],u) do

u[i,j]:=nmc[j-1]:

end do:

writedata[APPEND](cat(currentdir(),"u_",convert(k2,string),".txt"), [convert(Re(u[i]),list)]):

print(u[i,1]);

end do:

return finished:

end proc:

 

with(Threads[Task]):

Start(ArrayTools[Concatenate], 2, Task=[prc,1,20], Task=[prc,20+step,40]);

quit:

 

The Start(ArrayTools[Concatenate], 2, Task=[prc,1,20], Task=[prc,20+step,40]) function makes two tasks of calculation at the parameter ranges of 1-20 and 21-40. But in this case Start spends twice more time than simply prc(20+step,40). How to realize a multithreaded calculation?

By the way I don't need to use a Concatenate function in Start but without any procedure Start doesn't work.

In my Maple program results are exported to a file. But the problem is that I should write a path every time manually that complicates a work. Moreover, I often forget to change a path and correspondingly new results would often rewrite previous results stored in other directory. The reason is that the path of stored results folder have to be the same as the path of Maple code run.

How can to do it automatically? How to make that Maple knows a path from where Maple...

I have a matrix containing numeric values of functions. Each column corresponds to a function. The first element of each column is a name of a function and following elements are numeric values of this function.

For example:

t      a         b     c         d
0    0.5      38    0       0.9e-5

I solve one task. And as a result I receive a matrix and export it to a textfile. Then I receive another matrix and try to export it to the same textfile. Another words I need to add a last matrix to previous one but when I use exportmatrix command the last matrix overwrites previous one. What can do?

I solve system of ordinary differential equations numerically by method=rkf45 (Runge-Kutta Fehlberg method).

  1. Maple 13 installed on the Linux x64. Processor – AMD Phenom (4 cores). When Maple computes it uses only one core but other three cores stand idle. How to impel to compute other cores?
  2. When I solve system of ODE a calculation reaches closely 1 ns and stops. Maple writes that value of Maxfun exceeded. But I need solve system up to 10 μs....
1 2 Page 1 of 2