Ali Hassani

20 Reputation

One Badge

5 years, 294 days

MaplePrimes Activity


These are replies submitted by Ali Hassani

@Carl Love Thank you for your reply. I kindly ask you to send me an example of a numerical, ie. non-symbolic, solution of a set of equations in parallel through either ‘solve’ command with ‘numeric’ option or the ‘fsolve’ command. I want to take an idea to numerically solve equations in parallel with that example.

best wishes

@Carl Love 

Dear Carl,

As you said, the coding in Maple is not effective to write a program in shared-memory parallelism. To the best of my knowledge, the shared-memory parallelism is far more effective than an independent-memory one. On the other hand, Maple weakly treats shared-memory parallelism because of the essence of built-in serial programming. It is a major drawback for Maple, unfortunately.

@Carl Love
Dear Carl,
Thank you for your attention to me. I wish there is either an idea or an algorithm to solve the equations in parallel.
Generally, I think Maple is almost weak to convert built-in serial procedures into parallel ones. Unfortunately, many of the commands are not be able to automatically execute in parallel.
Best wishes
 

@Carl Love 

Dear Carl,

If possible, please solve for me a set of algebraic equations by the ‘solve’ in parallel, as an example. I hope that I take an idea through your specimen to solve other equations.

Do you send me the solution of an arbitrary set of equations in parallel?

Bset wishes

@Carl Love

Dear Carl,
Thank you for your attention to my problem. I am not sure the mentioned equation, which I am now involving, can be solved even in serial!. However, the solution of either linear or nonlinear some equation(s) is a permanent challenge for me. It is very important for me to find a way to solve equation(s) in parallel because I almost involve a linear or nonlinear set of equations taking long running time in serial.
Can you help me to overcome the problem forever?
 

Best wishes

@Carl Love 

Dear Carl,
Thanks very much for your refined comments on my summary which is itself useful and informative.

@Carl Love 

 

 
Dear Carl,
before anything, I appreciate it you consumed so much time to reply to my five questions.
I want to re-write what you told me above. If anything is incorrect, let me know.
1) A process is an "independently running" with no sharing the memory and, consequently, needs more memory than the "Threads" package which fundamentally works based on the shared memory.
2) The word "task" is not essentially limited to "Threads". "Task" is the smallest work unit.
3) Too large "tasksize" may be resulted in being idle some processors, and too small "tasksize" could lead to more large CPU-time.
4) If code is threadsafe, "Threads:-Map" command is preceded Grid:-Map. Unfortunately, because of uncontrolled sharing in writing in memory, many commands in Maple are not threadsafe.
 
However, I have a question. What is your goal of talking about “overhead for task initializations”? In other words, what is the meaning of overhead to initial the tasks?
 
best wishes

@Carl Love 

Dear Carl,

Thank you very much for your attention to my problem. Besides, I am sorry to not reply to your answer about “You didn't reply to my earlier Answer”. In fact, I am in much stress due to my work; nevertheless, I tried to study and reply to you as soon as possible. You told me you spent several hours writing that answer. I appreciate it you consumed your much time for me. 

Now, about simplification, I should say that I am much confused due to the behavior of Maple about simplification through the ‘simplify’ command. 

I attached the TXT file entitled “backup.txt” including elements of dummy_UU1.

 

UU:='UU';

dummy_UU1:='dummy_UU1';

dummy_UU1:=Map(simplify,Map(solve_proc,[seq(seq([Trans_Coef_Eq[2][k,h],UU[k+1,h]],h=0..num),k=0..num)])):

fd:=fopen("F:\\backup.txt",WRITE);

for i from 1 to nops(dummy_UU1) do

fprintf(fd,"dummy_UU1[%d]:=%s;\n",i,convert(dummy_UU1[i],string)):

end do;

fclose(fd):

 

When I use the ‘read’ command to import the components of dummy_UU1, everything is Ok, namely simplifications are correctly executed as the following:

read("F:\\backup.txt");

 

Wonderfully, when I tried to substitute the dummy_UU1 components into UU[k+1,h], as the following, it is seen that UU[k+1,h] are non-simplified!.

itr:=1;num:=5;

for k from 0 to num do

for h from 0 to num do

UU[k+1,h]:=dummy_UU1[itr];

print(k+1,h,itr);

itr:=itr+1;

end do:

end do:

 

 UU[5,1]; # for example

 

 Do you know why the reason of? 

About the time-running, I have to say that the simplifications of UU[k+1,h] are rapidly executed. However, I must simplify other parameters which request much CPU-time.

The below is the content of "backup.txt":
dummy_UU1[1]:=-UU[0,0]/(50.*UU[0,0]+10.);
dummy_UU1[2]:=(-50.*UU[1,0]-1.)*UU[0,1]/(50.*UU[0,0]+10.);
dummy_UU1[3]:=((-5.*UU[1,0]-.1)*UU[0,2]-5.*UU[0,1]*UU[1,1])/(5.*UU[0,0]+1.);
dummy_UU1[4]:=((-5.*UU[1,0]-.1)*UU[0,3]-5.*UU[0,1]*UU[1,2]-5.*UU[0,2]*UU[1,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[2,1]*UU[4,3]-5.*UU[2,2]*UU[4,2]-5.*UU[2,3]*UU[4,1]-5.*UU[2,4]*UU[4,0]-5.*UU[3,0]*UU[3,4]-5.*UU[3,1]*UU[3,3]-5.*UU[6,0]*UU[0,4]-5.*UU[6,1]*UU[0,3]-5.*UU[6,2]*UU[0,2]-5.*UU[6,3]*UU[0,1]-2.5*UU[3,2]^2)/(5.*UU[0,0]+1.);
dummy_UU1[36]:=((-5.*UU[1,0]-.1)*UU[5,5]-5.*UU[1,1]*UU[5,4]-5.*UU[1,2]*UU[5,3]-5.*UU[1,3]*UU[5,2]-5.*UU[1,4]*UU[5,1]-5.*UU[1,5]*UU[5,0]-5.*UU[2,0]*UU[4,5]-5.*UU[2,1]*UU[4,4]-5.*UU[2,2]*UU[4,3]-5.*UU[2,3]*UU[4,2]-5.*UU[2,4]*UU[4,1]-5.*UU[2,5]*UU[4,0]-5.*UU[3,0]*UU[3,5]-5.*UU[3,1]*UU[3,4]-5.*UU[3,2]*UU[3,3]-5.*UU[6,0]*UU[0,5]-5.*UU[6,1]*UU[0,4]-5.*UU[6,2]*UU[0,3]-5.*UU[6,3]*UU[0,2]-5.*UU[6,4]*UU[0,1])/(5.*UU[0,0]+1.);

 

@Carl Love Thanks very much for your attention to safely create the above code. Regarding your previous explanation, now I well realize why you added the Grid:-Wait(1) command. As I have already said, I learned many points due to the connection with you.

 

@Carl Love 

Hi again,
Thank you very much.
Best wishes

@Carl Love 

Dear Carl,
It is interesting and important hints which you explained to me. I learned much. It seems in many situations I can send a value of a variable from a node to another by using Grid:-Get and Grid:-Set commands as you did above. I don't want you to spend more time due to another question; hence, if it is possible please explain how and where "Send" and "Receive" commands are applied to transfer data from a node to another through a simple example (for example, in the above incorrect code of mine). If you are tired of my questions, don't worry and don't perform it. Nevertheless, I appreciate it you explained to me in detail.
Thank you very much.
Best wishes.

 

@Carl Love 

 

Dear Carl,

Thank you very much for your reply.

The answers are very informative for me especially about question 1.

However, I was not unfortunately convinced of the answer to question 2. I used Grid-MyNode() command to show the master node, which was the same node 0; Unless the Grid:-MyNode() command isn't the correct one to find the "master" node.

If it is possible please modify my code to transfer the value of a from node 0 to node 1. Besides, It is worth mentioning that by executing two last commands, nor any error returns neither the execution is stopped!

Again, I emphasize I learned much about the answer to question 1.

I am eagerly looking forward to your reply

Thanks in advance

 

restart;
Grid:-MyNode();
master:=Grid:-MyNode();
Grid:-Run(master,"a:=2;a;");
Grid:-Wait(master);
Grid:-GetLastResult(master);
Grid:-Send(master+1,a);
a_1:=Grid:-Receive(master);

 

@Carl Love 

Dear Carl,


Thanks so much

My Maple version is 2020.

@mmcdara 

Hi,
Thanks so much

Best wishes

@Carl Love 

Hi again,
Your comments are very useful.
Thanks so much

1 2 Page 1 of 2