• No results found

Domains are first-class index sets Specify the size and shape of arrays Support iteration, array operations, etc.

N/A
N/A
Protected

Academic year: 2021

Share "Domains are first-class index sets Specify the size and shape of arrays Support iteration, array operations, etc."

Copied!
21
0
0

Loading.... (view fulltext now)

Full text

(1)
(2)

Domains are first-class index sets

Specify the size and shape of arrays

Support iteration, array operations, etc.

D

InnerD

A

B

2 Chapel: Domain Maps

(3)

Q1:

How are arrays laid out in memory?

 Are regular arrays laid out in row- or column-major order? Or…?

 What data structure is used to store sparse arrays? (COO, CSR, …?)

Q2:

How are data parallel operators implemented?

 How many tasks?

 How is the iteration space divided between the tasks?

A:

Chapel’s domain maps

are designed to give the user

full control over such decisions

(4)

Data Parallelism Revisited

Domain Maps

Layouts

Distributions

4 Chapel: Domain Maps

(5)

Domain maps are “recipes” that instruct the compiler

how to map the global view of a computation…

…to a locale’s memory and processors:

= + α L0 L1 L2 = + α = + α = + α

(6)

Domain maps define:

Ownership of domain indices and array elementsUnderlying representation of indices and elements  Standard operations on domains and arrays

 E.g, iteration, slicing, access, reindexing, rank change

How to farm out work

 E.g., forall loops over distributed domains/arrays

Domain maps are built using Chapel concepts

classes, iterators, type inference, generic types  task parallelism

locales and on-clausesother domains and arrays

Chapel: Domain Maps 6

Domain Maps Data Parallelism Task Parallelism Base Language Target Machine Locality Control

(7)

Domain Maps fall into two major categories:

layouts:

target a single shared memory segment

(that is, a desktop machine or multicore node)examples: row- and column-major order, tilings,

compressed sparse row

distributions:

target distinct memory segments

(that is a distributed memory cluster or supercomputer)examples: Block, Cyclic, Block-Cyclic, Recursive Bisection, …

(8)

1

var Dom: domain(2) dmapped Block(boundingBox=[1..4, 1..8])

= [1..4, 1..8];

1 8

4

distributed to

var Dom: domain(2) dmapped Cyclic(startIdx=(1,1))

= [1..4, 1..8]; L0 L1 L2 L3 L4 L5 L6 L7 1 1 8 4 L0 L1 L2 L3 L4 L5 L6 L7 distributed to 1 8 Chapel: Domain Maps

(9)

1. Chapel provides a library of standard domain maps

 to support common array implementations effortlessly

2. Advanced users can write their own domain maps in Chapel

 to cope with shortcomings in our standard library

3. Chapel’s standard layouts and distributions will be written

using the same user-defined domain map framework

 to avoid a performance cliff between “built-in” and user-defined domain maps

4. Domain maps should only affect implementation and

performance, not semantics

(10)

Syntax

Semantics

Domain maps specify how a domain and its arrays are

implemented

Examples

Chapel: Domain Maps 10

dmap-type:

dmap(dmap-class(…))

dmap-value:

new dmap(new dmap-class(…))

use myDMapMod;

var DMap: dmap(myDMap(…)) = new dmap(new myDMap(…));

var Dom: domain(…) dmapped DMap;

(11)

The following:

May be written:

(we also have some plans for cleaning up the

non-sugared syntax a bit…)

var Dom: domain(…) dmapped new dmap(new myDMap(…));

(12)

All domain types support domain maps

Semantics are independent of the domain map, but

performance will vary

“steve” “lee” “sung” “david” “jacob” “albert” “brad”

(13)

Data Parallelism Revisited

Domain Maps

Chapel Standard Layouts and Distributions

Block

Cyclic

(14)

Chapel: Domain Maps 14

def Block(boundingBox: domain,

targetLocales: [] locale = Locales,

dataParTasksPerLocale = ...,

dataParIgnoreRunningTasks = ..., dataParMinGranularity = ...,

param rank = boundingBox.rank,

type idxType = boundingBox.dim(1).eltType)

1 1 8 4 L0 L1 L2 L3 L4 L5 L6 L7 distributed to 1

(15)

def Cyclic(startIdx,

targetLocales: [] locale = Locales,

dataParTasksPerLocale = ...,

dataParIgnoreRunningTasks = ..., dataParMinGranularity = ...,

param rank: int = infered from startIdx,

type idxType = infered from startIdx)

distributed to L0 L1 L2 L3 L4 L5 L6 L7 1 1 8 4

(16)

Full-featured Block- and Cyclic distributions

Single-locale COO and CSR Sparse layouts supported

Serial quadratic probing Associative layout supported

Block-Cyclic, Associative distributions underway

Parallel irregular layouts and distributions underway

Memory currently leaked for distributed arrays

Need to finalize user-defined domain map interfaces

(17)

Advanced uses of domain maps:

GPU programming

Dynamic load balancing  Resilient computation

in situ interoperability

(18)

Data Parallelism Revisited

Domain maps

 Layouts

Distributions

The Chapel Standard Distributions

Block DistributionCyclic Distribution

User-defined Domain Maps

18 Chapel: Domain Maps

(19)
(20)

Chapel: Domain Maps 20

Domain Map Domain Array

Global one instance per object (logically) Local one instance per node per object (typically) Role: Similar to

layout’s domain map descriptor Role: Similar to layout’s domain descriptor, but no Θ(#indices) storage Size: Θ(1) Role: Similar to layout’s array

descriptor, but data is moved to local descriptors

Size: Θ(1)

Role:Stores node-specific domain map parameters

Role: Stores node’s

subset of domain’s index set

Size: Θ(1) →

Θ(#indices / #nodes)

Role: Stores node’s

subset of array’s elements

Size:

(21)

Domain Map Domain Array Global one instance per object (logically) Local one instance per node per object (typically)

var Dom: domain(2) dmapped Block(boundingBox=[1..4, 1..8])

= [1..4, 1..8]; boundingBox = [1..4, 1..8] targetLocales = indexSet = [1..4, 1..8] myIndexSpace = [3..max, min..2] myIndices = [3..4, 1..2] myElems = L0 L1 L2 L3 L4 L5 L6 L7 L4 L4 L4

References

Related documents

• NIDA Clinical Trials Network database: Data on drug abuse trials and related studies: https://datashare.nida.nih.gov/. • ACCT or Aggregate Analysis of ClinicalTrials.gov data

One hundred twelve species of aquatic and semiaquatic Coleoptera iden- tified from the GPIR during the period 2001-2012, along with the collection method, months collected, numbers

Concept of Structured data: Data structure definition, Different types and classification of data structures, Operations on Data structures, Arrays – representation of array

Zde ovšem naše paralela končí. Je třeba se poučit, srovnat srovnatelné, ale zároveň si i uvědomit odlišný rozsah obou krizí a důvody, proč tomu tak je. Ne všechny

Spraytec, Fulltec Plus, Fulltec Ultra, Fulltec Zinc, Fulltec Impulse Corn, Fulltec Impulse Soy, Fulltec Cube, Fulltec K, and Fulltec Adjuvant are trademarks of Spraytec

Fill out M2M Practice Order Form and Fax - we will install MaxxTraxx for practice use Review the MotorTraxx Converted Data.. Attend a Setup/Strategy Meeting with

If the inspiration of the itinerary is from listening to experiences family friends, the decision making still becomes biased since it is some other person’s experience, moreover

(This course introduces object-oriented computer programming using the C++ programming language. Topics include input/output operations, iteration, arithmetic operations,