Ali Hassani

120 Reputation

4 Badges

10 years, 117 days

MaplePrimes Activity


These are questions asked by Ali Hassani

 

Dear All,

I want to apply the ‘simplify’ command, in parallel, for the simplification of some parameters. Both Grid:-Map and Grid:-Run commands are tested. There is no error in both, whereas no simplification is implemented. It seems that the ‘simplify’ command correctly works on only ‘Master’ node, namely anywhere we are typing.

Can anyone help me to simplify in parallel. I examined two following codes.

1)

with (Grid);

for i from 1 to nops(dummy_UU1) do

freenode:=WaitForFirst():

Run(freenode,simplify,[dummy_UU1[i]],assignto='dummy_UU2'[i]):

end do:

Wait();

2)

dummy_UU2:=Map[tasksize=1](simplify,[seq(dummy_UU1[i],i=1..nops(dummy_UU1))]):

 

 

The following code is correctly executed and resulted in the simplification of dummy_UU1 components in serial.

for i from 1 to nops(dummy_UU1) do

dummy_UU2[i]:=simplify(dummy_UU1[i]):

end do:

 

 

Dear everyone,

I want to execute a simple example by using Grid:-Send and Grid:-Receive commands. I have two questions:
1) Why does the Grid:-GetLastResult(0) command not return anything?

2) I tried to send the value of a, namely 2, from node 0 to node 1. It seems the execution is not stopped by Grid:-Send(1,a) and a_1:=Grid:-Receive(0) while CPU is not working.
Would anyone guide me?

The answer to the second question is more important to me.

Best wishes

 

 

restart;

Grid:-Run(0,"a:=2;");

Grid:-GetLastResult(0);

Grid:-Get(0,a);

Grid:-Send(1,a);

a_1:=Grid:-Receive(0);

 

Dear All,

I am studying parallel programming in Maple. Two words are important keys in parallel programming. The one is “task”, and another is “process”. In the help pages of Maple are said the Grid:-Map package is executed in separate “processes”, while the Threads:-Map command is tried to divide the input into separate “tasks”.

  1. What is the difference between the “process” and “task” conception and meaning in Threads and Grid packages?
  2. What is the discrepancy between Grid:-Map and Threads:-Map commands in the practice and execution?
  3. Between the “process” and “task”, which one of them does have the smaller run-time?
  4. What is the default value of “tasksize” option in Grid:-Map and Threads:-Map commands,
  5. Does or the larger value of the “tasksize” option results in smaller run-time either the smaller value of that?

 

Can anyone explain to me the above questions?

Thanks in advance,

Best wishes

 

Dear All,
Before anything, I have to convey that this question has been already asked by me; however, I don't know why my question has been deleted by MaplePrimes!!!
It is necessary to mention that two persons replied to my question which I can't see them, unfortunately. Nevertheless, if it is possible, please send me your reply to Hassani@nit.ac.ir.
Now, My question is as follows.
I could apply ‘map’ command to execute ‘taylor’ command of sine function as the following:
map(taylor, [sin(x)],x=0,10);
The above is equivalent to the below:
taylor(sin(x),x=0,10);
However, I can’t apply “Grid:-Map” command to derive Taylor series of the sine function. The below command returns an error.
Grid:-Map(taylor,[sin(x)],x=0,10);
Can anyone tell me the reason of?
Best wishes,

Dear All,
I want to learn to work with Thread[Task] packages in Maple.However, I am confused when I studied the Help of Maple about. I can’t find out the Start and Continue command in the package. I can’t execute any simple program by Threads [Task]. The help of Maple has an example of the following:
with(Threads[Task]);
cont := proc( a, b )
   return a + b;
end proc;      
task := proc( i, j )
   local k;
   if ( j-i < 1000 ) then
       return add( k, k=i..j );
   else
       k := floor( (j-i)/2 )+i;
       Continue( cont, Task=[ task, i, k ], Task=[ task, k+1, j ] );
   end if;
end proc;
Start(task, 1, 10^7);

I want to remove if-clause in task procedure as the following. In the other words, I want to use multi-threads for any values of i and j. However, the program doesn’t work correctly. What hint is something I don’t correctly understand?

Besides, I may don’t find deeply out the meaning and deference of parent, leaf, child, and continuation tasks. would you explain to me those tasks easily? The help of Maple doesn't convey a unified explanation for them.
 
Please guide me to overcome the problem.
Best wishes,
 
with(Threads[Task]);
cont := proc( a, b )
   return a + b;
end proc;      
task := proc( i, j )
   local k;
        k := floor( (j-i)/2 )+i;
       Continue( cont, Task=[ task, i, k ], Task=[ task, k+1, j ] );
end proc;
Start(task, 1, 10^7);
1 2 3 4 5 Page 4 of 5