Threads - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Multithreaded Programming : Threads/Map

Threads

  

Map

  

a parallel implementation of map

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Map( fcn, expr, arg1, ..., argN )

Map[n]( fcn, arg1, ..., argn-1, expr, argn, ..., argN )

Map[evalhf]( fcn, expr, ... )

Map[inplace]( fcn, expr, ... )

Map[ tasksize = s ]( fcn, expr, ... )

Parameters

fcn

-

(procedure or name)

expr

-

any expression

argi

-

(optional) further arguments to fcn

n

-

(posint)

s

-

(optional, posint) maximum task size

Description

• 

The Map command is a parallel implementation of the map command. For a complete description of the calling sequence of Map, see the map help page.

• 

Map is implemented using the Task programming model.

• 

Map attempts to determine how to divide the input into separate tasks to spread the work across all available cores.  However in some situations Map may not choose the optimal size.  In particular a small number of long running tasks may not be spread evenly over all threads.  In this case, you can specify the maximum task size using the tasksize option. Map will divide the input into tasks that compute at most tasksize elements within a single task.

Examples

withThreads:

Mapf,x+yz

fyz+fx

(1)

Mapf,yz

fyfz

(2)

Mapf,a,b,c

fa,fb,fc

(3)

Mapx→x2,x+y

x2+y2

(4)

Map( proc( x, y ) x^2+y end proc, [ 1, 2, 3, 4], 2 );

3,6,11,18

(5)

See Also

map

Threads[Add]

Threads[Mul]

Threads[Seq]