






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The importance of parallel programming in light of the limitations of cpu performance growth. It discusses cpu-bound parallelism in f# 3.0 and i/o-bound parallelism using tasks in .net, illustrated with examples in c#. The document also covers asynchronous programming in c# 4.5.
Typology: Slides
1 / 10
This page cannot be seen from the preview
Don't miss anything!







1
2
4
5
Making it easy to program a machine that requires 10 billion threads to use at full capacity is also a challenge.
While a backward compatible path will be provided to allow existing MPI codes to run, MPI plus C++ or Fortran is not a productive programming environment for a machine of this scale.
We need to move toward higher-level programming models where the programmer describes the algorithm with all available parallelism and locality exposed , and tools automate much of the process of efficiently mapping and tuning the program to a particular target machine.
Bill Dally in HPC Wire, 15 April 2013
7
let fibs = [ for i in 0..40 -> slowfib(i) ];; // Real: 00:00:06.908, CPU: 00:00:06.
let fibs = let tasks = [ for i in 0..40 -> async { return slowfib(i) } ] Async.RunSynchronously (Async.Parallel tasks);; // Real: 00:00:03.665, CPU: 00:00:06.
8
async { return slowfib(i) }
let tasks = [ for i in 0..40 -> async { return slowfib(i) } ]
Async.Parallel tasks
Async.RunSynchronously (Async.Parallel tasks)
let tasks = [ for i in 0..40 -> async { return slowfib(i) } ] Async.RunSynchronously (Async.Parallel tasks);;
Async
Async
Async<float []>
float []
An asynchronous task that will produce a float
List of asynchronous tasks that each will produce a float
An asynchronous task that will produce a float array
A float array
10
factors 973475;; val it : int list = [5; 5; 23; 1693]
Array.init 100000 factors;; Real: 00:00:03.036, CPU: 00:00:03.035, GC gen0: 1, gen1: 0 val it : int list [] = [|[]; []; [2]; [3]; [2; 2]; [5]; [2; 3]; [7]; ... |]
let factors100000 = Array.Parallel.init 100000 factors;; Real: 00:00:01.550, CPU: 00:00:03.048, GC gen0: 1, gen1: 0 val factors100000 : int list [] = [|[]; []; [2]; [3]; [2; 2]; [5]; [2; 3]; [7]; ... |]
Array.init : int -> (int -> 'a) -> 'a []