Math 4370/6370 Lecture 4:
SharedMemory Parallel
Programming with OpenMP
Daniel R. Reynolds
Spring 2017
[email protected]
SMP Review
Multiprocessors:
Multiple CPUs are attached to the bus.
All processors share the same primary
memory.
The same memory addre
Math 4370/6370 Lecture 5:
DistributedMemory Parallel
Programming with MPI
Daniel R. Reynolds
Spring 2017
[email protected]
Recall: Parallel Computing Hardware
Multiprocessor:
Multicore:
Multicomputer:
Motivation
As easy as OpenMP is to use, it cannot solv
Math 4370/6370 Lecture 2:
Fortran Introduction for
Matlab Programmers
Daniel R. Reynolds
Spring 2017
[email protected]
program Driver
!!= Declarations =
implicit none
integer : n, i, ierr
double precision, allocatable : u(:), v(:)
double precision : sum
n
Math 4370/6370 Lecture 2:
C+ Introduction for
Matlab Programmers
Daniel R. Reynolds
Spring 2017
[email protected]
Example C+ Program
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
/ Example C+ routine
int main(int argc, char* argv[]) cfw_
/ decla
Math 4370/6370, Spring 2015
Due 20 February 2015
Homework 2 C Programming
Place your code for this homework into a directory entitled HW2 within your Bitbucket repository.
Write a Makefile that will compile your class, functions and main() routines into e
Math 4370/6370 Lecture 1:
Machines and Computation
Daniel R. Reynolds
Spring 2017
[email protected]
Historically, we have
depended on hardware
advances to enable faster
and larger simulations.
In 1965, Gordon Moore
observed that the CPU and
RAM transistor
Math 4370/6370, Spring 2015
Due 20 February 2015
Homework 2 C+ Programming
Place your code for this homework into a directory entitled HW2 within your Bitbucket repository.
Write a Makefile that will compile your class, functions and main() routines into
Math 4370/6370 Lecture 3:
Best Practices for
Scientific Computing
Daniel R. Reynolds
Spring 2017
[email protected]
Why Best Practices?
Many scientists/mathematicians use computing in their research, but
most have never taken formal Computer Science courses
Math 4370/6370, Spring 2015
Due 2 February 2015
Homework 1 Machines and Computation
1. Under the assumption of Amdahls Law, find what fraction of a program must be parallelizable to maintain a parallel efficiency of 85% for process numbers p = cfw_5, 25,
Math 6370, Spring 2015
Due 24 April 2015
Homework 4 MPI Programming
The first problem of this assignment involves programming there are C+, C and Fortran
versions; you should pick one of these languages. To turn in this problem, place your code into
a dir
Math 4370, Spring 2015
Due 24 April 2015
Homework 4 MPI Programming
There are C+, C and Fortran versions of this homework assignment; you should pick one
of these languages. To turn in, place your code into a directory entitled HW4 within the top
level of
Math 4370/6370
Parallel Scientific Computing
Daniel R. Reynolds
Spring 2017
[email protected]
Parallel computing historically focused on stateoftheart engineering and scientific
applications. However, video game consoles, laptops, desktops and even cell
Math 4370/6370, Spring 2015
Due 27 March 2015
Homework 3 OpenMP Programming
There are C+, C and F90 versions of this assignment; you should pick one of these languages.
To turn in, place your code for this homework into a directory entitled HW3 within the
1
Lecture 3 : Rootfinding
section 3.1 : bisection method
def : Given f (x), a number r satisfying f (r) = 0 is called a root of f (x).
ex : f (x) = x2 3 r = 3
question : How can we find the roots of a general function f (x)?
thm (Intermediate Value Theore
1
Lecture 2 : Errors in scientific computing
absolute error vs relative error
absolute error = exact value  approximate value
exact value  approximate value

relative error = 
exact value
(e.g. the height of mount everest: 29,029ft vs the length of
Math3315 / CSE3365
Spring 2017
Project 2 due: Tue., April 4, 2017
Project Description
This project studies polynomial interpolation, which are composed of two parts: 1) the
polynomial interpolations on uniform points and Chebyshev points; and 2) cubic spl
Math3315 / CSE3365
Spring 2017
Homework 3
due: Thu., Feb. 23, 2017
YICHEN DUAN
1. Suppose the equation f(x) = 0 is solved by the bisection method with a = 0 and b = 3. How many
steps are needed to ensure the error is less than 10 4?
[a, b] = [0, 3]
rxn
1. In front of a computer with Python installed, read Chapter 1: Introduction to Python from the
textbook. Practice the commands and examples enclosed in the book. Sign below to state the
completion of this problem. I nished reading and practicing the rst
Math3315 / CSE3365
Spring 2017
Project 1 due: Tuesday, Feb. 21, 2017
Project Description
This project studies numerical errors, which are composed of two parts: the roundoff errors
and the truncation errors. We will first work on the truncation errors by
Math3315 / CSE3365
Spring 2017
Homework 4 due: Thu., March 2, 2016
1. Given the data (x0 , x1 , x2 ) = (2, 4, 5), (y0 , y1 , y2 ) = (1, 4, 8)
a) Use the Lagrange interpolation process to obtain a polynomial of least degree that assumes
these values.
b) Co
Math3315 / CSE3365
Spring 2017
1. a) Convert (2010)10 to base 2.
Homework 2 due: Thu., Feb. 9, 2017
b) Convert (110110.001)2 to base 10.
2. The floating point representation of a real number has the form (0.d1 d2 . . . dn ) e ,
where d1 6= 0 and M e M . C
Homework 1 Solutions
Math 587
1) Find positive functions f (x),g(x), continuous on (0, ) so that f = O(g(x)
as x 0, but limx0 f (x)/g(x) does not exist.
One can take f (x) = sin(1/x) and g(x) = 1, for example.
2) Find all so that f = O( ) for the followin
Math 587 Homework 4 Solutions
Problem 1
Consider an integral like
Z
f (t) exp(ix(t) dt
which has a single stationary phase point at t = 0. Suppose that f t and (t) at3 as t 0.
(a) Evaluate
Z
t exp(ixt3 ) dt
(b) Is it justified to find the leading order be
Homework 7 solutions
Math 587
Problem 1
Show formally that the Van der Pol oscillator has a limit cycle.
ytt + y + (y 2 1)yt = 0
Solution:
Let t = T and define Yi (t, T ) such that
y(t) = Y0 (t, T ) + Y1 (t, T ) + O(2 )
Then
i
h
h
yt (t) = Y0t + Y0T T 0 +
Homework 3
Math 587
1. Find a threeterm expansion as x 0+ of
Z
1
cos(xt)dt
x
2. (Bender & Orszag 6.18(b) Consider
Z
cos(xt)
dt.
t
1
(a) For which limit(s), x 0+ and/or x , is integration by parts useful?
(b) Find the leading order behavior for x 0+ (hin
Homework 2 Solutions
Math 587
1. Classify the points at 0 and for x7 y 0000 = y 0 .
Solution: We can write our equation as y 0000 x17 y 0 = 0, and since (1/x7 )x3 is not analytic at x = 0, the
point at zero is irregular singular. In order to classify the
1) The Boussinesq approximation for shallow water waves reads
utt = c2 uxx + uxxxx + (u2 )xx ,
< x < ,
t > 0.
As with our KleinGordon example, it is useful to look for solutions as slow modulations
of linear waves of the form cos(kx t). Let = kx t and l
Math 587 Homework 3 Solutions
1. The Taylor series for cos(xt) about x = 0 is given by
(1)2n+1 (xt)2n
1
1
= 1 x2 t2 + x4 t4 . . .
(2n)!
2
24
n=0
cos(xt)
We manipulate the integral slightly to improve upon this series approximation:
x
1
cos(xt)dt =
0
x
c