2. disciplined programming models.pdf

15
Disciplined Programming Models -Disciplined Shared Memory -Parallel Operators -Metaprogramming and Autotuning -Domain-Spe cific Environments -Actors

Upload: daniel-j-malaver-camelo

Post on 02-Jun-2018

229 views

Category:

Documents


0 download

TRANSCRIPT

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 1/17

Disciplined ProgramminModels

-Disciplined Shared Memory-Parallel Operators

-Metaprogramming and Autotuning

-Domain-Specific Environments

-Actors

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 2/17

Disciplined Programming Models

-Programing in a way that prevents conflicts

when using multiple thread algorithms.[1]

-This is made possible by establishing a set ofconventions that must be followed.[2]

*the conventions cover from handling memoryissues to how many threads should be used.

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 3/17

Disciplined Shared Memory

-The use of a shaprogramming model fexpression of many ain its current incarnanot offer adequate prprogram defects.[2]

*Decreasing concurrency

parallel programing.

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 4/17

Disciplined Shared Memory

-Data-race: Two or more threads in aprocess access the same memory l

concurrently, and at least one of the a

is for writing, and the threads are no

any exclusive locks to control their acce

that memory.[3]

*the three conditions must be met.

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 5/17

Disciplined Shared Memory

-Data-race-free:Avoiding dataraces from occurring in your

program in order to prevent

concurrency related bugs. [2]

-The way to do this is by havingwell defined exceptions that are

capable of detecting them.

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 6/17

Disciplined Shared Memory

-Determinism: The program mudeterministic, or repeatable, mean

produces the very same output when gi

same input no matter how many tim

run.[4]

*We have to prevent the program from changing its outcome b

order in which the threads are executed.

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 7/17

Disciplined Shared Memory

-Disciplined Control and Synchronizatiuse of well-structured parallel contr

allows for well behaved parallel con

such as nested parallel loops or

dataflow programs, that lead to a simp

of execution state, simplifying reason

programmers and compilers. [2]

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 8/17

Parallel Operators

-Their function is to run a computateach processor with the data that is ava[5]

-This operators take encapsulated data sarrays and manipulate in a single iterati

information inside them. [2]

*e.g: Map takes as input a vector and an operation, and returns a

that is the result of applying the operation on each element of the

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 9/17

Parallel Operators

-This operators give particularly useful fdisciplined control by ensuring determin

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 10/17

Metaprogramming and Autotuni

-Metaprogramming:Is thewriting of computer programs

that are capable of writing

new ones or rewriting

themselves. [6]

-This is done at compile time.* This is usually achieved through the use of

libraries.

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 11/17

Metaprogramming and Autotuni

-Autotuning:The ability of programcompilers to optimize themselves

machine that it is being run on. [2]

*The autotuning allows for the best performance when using mult

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 12/17

Metaprogramming and Autotuni

-The objective of combining thitechniques is to simplify the the pro

creating an autotuning program with t

of metaprogramming to reduce the wo

needs to be done by the programer. [2]

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 13/17

Domain-Specific Environments

-This discipline states that theprograming languages should hide the

programming inside them. [2]

-The domain specific environments alibraries or languages that achieve this.

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 14/17

Domain-Specific Environments

-The parallelism part of code writing ignored by the programer.

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 15/17

Actors

-Actors are objects that are capable ofautonomously operating with others in o

to achieve parallelism. [2]

-It is a discipline of giving control back

objects from the threads, letting them

how to use the threads for communicat

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 16/17

Actors

-The lifecycle of an actor involves creatprocessing messages one after the othe

destruction. [2]

-The communication between actors is

through asynchronous messages. [2]

8/11/2019 2. Disciplined Programming Models.pdf

http://slidepdf.com/reader/full/2-disciplined-programming-modelspdf 17/17

Actors

-Asynchronous operation allows flexibiliplacement and scheduling actors on diff

cores, as well as facilitating mobility. [2]