Foundations of Programming for High Performance Computing
COMP SCI 2101

Fall 2013
#
# Serial and simple genetic algorithm #
#
@everywhere function SerialSimpleGeneticAlgorithm(A,S,P,T)
# S is the length of the digital encoding
# of an individual
# P is the size of the population
# T is the number of generations
for t=0:(T1)
present =
Foundations of Programming for High Performance Computing
COMP SCI 2101

Fall 2013
Foundations of Programming for High Performance Computing: CS2101.
2013.
UWO, December, 14,
Student name:
Student ID number:
Guidelines. The exam is closed book and all notes are forbidden. The duration is 3 hours. There are
24 pages in the exam. The last
Foundations of Programming for High Performance Computing
COMP SCI 2101

Fall 2013
Cache Memories
Marc Moreno Maza
University of Western Ontario, London, Ontario (Canada)
CS2101 October 2012
Once upon a time, everything was slow in a computer.
The second space race . . .
Plan
1
Hierarchical memories and their impact on our programs
2
Ca
Foundations of Programming for High Performance Computing
COMP SCI 2101

Fall 2013
Divide and Conquer
Divide the problem into several subproblems of equal size.
Recursively solve each subproblem in parallel. Merge the
solutions to the various subproblems into a solution for the
original problem.
Dividing the problem is usually straightf
Foundations of Programming for High Performance Computing
COMP SCI 2101

Fall 2013
CS2101
Due: Tuesday 2nd of December 2014
Problem Set 3
CS2101
Submission instructions on last page
PROBBLEM 1. [100 points]
In class, we went through a tutorial on the subject of genetic algorithms. Here a few
introductory pointers.
http:/en.wikipedia.or
Foundations of Programming for High Performance Computing
COMP SCI 2101

Fall 2013
CS2101
Due: Friday 10th of October 2014
Problem Set 1
CS2101
Submission instructions on last page
PROBBLEM 1. [40 points]
The value of can be calculated in a number of ways. Consider the following method of
approximating :
(1) Inscribe a circle (of radiu
Foundations of Programming for High Performance Computing
COMP SCI 2101

Fall 2013
CS2101
Due: Monday 3rd of November 2014
Problem Set 2
CS2101
Submission instructions on last page
PROBBLEM 1. [20 points]
In this problem, we consider dierent ways of computing the dot product of two vectors.
Question 1. [5 points] Write rst a Julia func
Foundations of Programming for High Performance Computing
COMP SCI 2101

Fall 2013
Genetic Algorithms:
A Tutorial
Genetic Algorithms are
good at taking large,
potentially huge search
spaces and navigating
them, looking for optimal
combinations of things,
solutions you might not
otherwise find in a
lifetime.
 Salvatore Mangano
Computer
Foundations of Programming for High Performance Computing
COMP SCI 2101

Fall 2013
CS2101a Foundations of Programming for
High Performance Computing
Marc Moreno Maza & Ning Xie
University of Western Ontario, London, Ontario (Canada)
CS2101
Plan
1
Course Overview
2
Hardware Acceleration Technologies
3
Highperformance Computing
Course Ov
Foundations of Programming for High Performance Computing
COMP SCI 2101

Fall 2013
An Overview of Parallel Computing
Marc Moreno Maza
University of Western Ontario, London, Ontario (Canada)
CS2101
Plan
1
Hardware
2
Types of Parallelism
3
Concurrency Platforms: Three Examples
Cilk
CUDA
MPI
Hardware
Plan
1
Hardware
2
Types of Parallelism
Foundations of Programming for High Performance Computing
COMP SCI 2101

Fall 2013
@everywhere function PiSerial(n)
d=0
for i=1:n
x=rand()
y=rand()
if x^2 + y^2 < 1
d = d +1
end
end
4 *d/n
end
function PiParallel(n,p)
q = div(n,p)
refs = [@spawnat i PiSerial(q) for i=1:p]
sum(pmap(fetch,refs) / p
end
n = 10^7
@time PiSerial(n)
@time PiP
Foundations of Programming for High Performance Computing
COMP SCI 2101

Fall 2013
Foundations of Programming for High Performance Computing: CS2101.
2013.
UWO, November, 5,
Student name:
Student ID number:
Guidelines. The exam is closed book and all notes are forbidden. The duration is 1 hour 40 minutes.
There are 20 pages in the exam.
Foundations of Programming for High Performance Computing
COMP SCI 2101

Fall 2013
Parallel and Distributed Ccomputing with Julia
Marc Moreno Maza
University of Western Ontario, London, Ontario (Canada)
CS2101 (updated October 16, 2014)
Plan
1
Tasks: Concurrent Function Calls
2
Julias Prnciples for Parallel Computing
3
Tips on Moving Co