Seq - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Grid

  

Seq

  

generate a sequence, distributing computation over grid

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

Seq( f, i=m..n ))

Seq( f, i=x ))

Seq[tasksize=T]( f, i=... ))

Parameters

f

-

any expression

i

-

name

m, n

-

numerical values

x

-

expression

T

-

posint

Description

• 

The Seq command is used to construct a sequence of values in parallel. The most typical calling sequence is Seq(f(i), i = 1..n) which generates the sequence f(1), f(2), ..., f(n).  Computation of each f(i) will be evenly distributed across all available nodes.

• 

The Seq command is similar to the top-level seq command, and the Threads[Seq] commands.  The top-level seq command evaluates the entire sequence serially.  The Threads[Seq] command evaluates elements of the sequence in parallel on separate threads within the same process.  The Grid:-Seq command evaluates elements of the sequence in parallel on separate processes, and potentially on different machines.

• 

The Seq command attempts to initialize remote compute nodes by looking for named values inside of f and assigning those same names in the remote compute nodes.  The i, m, n, and x parameters are not searched.  If those depend on values that are not fully defined on the remote nodes, use the Grid:-Set command before calling Seq to set those values.  Similarly, Grid:-Set may be needed to complete the definition of f, in particular, when f is a procedure that calls other locally defined procedures.

• 

Seq will always try to use all compute nodes. It will typically subdivide the request into many more tasks than there are available nodes. This helps to more evenly distribute the load when the run-time of processing different requests is unevenly distributed. However, in some situations Seq may not choose the optimal size. In particular, when there are a large number of short-running tasks, doing more work in the remote nodes in each task may be more efficient. In this case, you can specify the task size using the tasksize option. Seq will divide the input into tasks that compute at most tasksize elements within a single task.

• 

Seq is a high-level command that uses Send and Receive calls. Therefore, evaluation of f should not involve other Send and Receive calls.

• 

Seq does not replicate the special evaluation rules of the Maple seq command. Structures with more than one dimension (like a Matrix) are not currently supported for the x parameter.

• 

Setting infolevel[Grid:-Seq] := 3; will enable output of information messages relating to the progress of the computation.

• 

When using "hpc" or "mpi" modes, Seq is designed to be called on all the nodes of a parallel computation, whereupon the result will only be available on node 0. If the resulting Maple expression is required for further computation on other nodes, it must be sent there explicitly using Send and Receive.

Examples

This example shows some simple calling sequences

Grid:-Seqi,i=1..4

1,2,3,4

(1)

AArray1,2,3,4,5

A12345

(2)

Grid:-SeqFi,i=A

F1,F2,F3,F4,F5

(3)

In this example, we define two procedures such that Seq will not be able to automatically find all definitions to send to external nodes. The remote operation is not fully defined.  

myfunc1xx2

myfunc1xx2

(4)

myfunc2xmyfunc1x+x

myfunc2xmyfunc1x+x

(5)

Grid:-Seqmyfunc2i,i=1..3

myfunc11+1,myfunc12+2,myfunc13+3

(6)

The myfunc1 procedure was not defined in the external nodes. It needs to be set.

Grid:-Setmyfunc1

Grid:-Seqmyfunc2i,i=1..3

2,6,12

(7)

In this example, the work required for the computation at j=1 is much less than the computation at j=9.  The sequence of heavy computations at the end of the list may require an adjustment to the default tasksize

timerealGrid:-Seqaddi,i=1..10min7,j,j=1..9

0.506

(8)

timerealGrid:-Seqtasksize=1addi,i=1..10min7,j,j=1..9

0.493

(9)

Compatibility

• 

The Grid[Seq] command was introduced in Maple 15.

• 

For more information on Maple 15 changes, see Updates in Maple 15.

• 

The Grid[Seq] command was updated in Maple 2015.

• 

The T parameter was introduced in Maple 2015.

• 

For more information on Maple 2015 changes, see Updates in Maple 2015.

See Also

Grid

Grid[Receive]

Grid[Send]

seq

Threads[Seq]