Information Technology Reference
In-Depth Information
Tabl e 5. 5 The CPU time (in seconds) needed for solving ( 5.138 ) using an explicit Euler scheme
on a 600MHz Pentium III processor
n
CPU time
y n
100,000
0.05
9.9181
200,000
0.09
10.549
300,000
0.13
10.919
400,000
0.18
11.183
Exercise 5.3. When you are using programs to construct simulations, you often
need an estimate of the CPU time needed for running the simulation, since cer-
tain parameters have changed. Sometimes, this may be a very hard problem to
solve, because it is not clear how the CPU effort depends on the parameters. In this
exercise, we will consider a very simple program in order to illustrate how timing
estimates can be generated.
Suppose we want a numerical solution of the problem
y 0 .t / D e y.t/ ;
.0/ D 0
(5.138)
for 0 t 1. We try to solve ( 5.138 ) using a standard explicit Euler scheme,
D y k C t e y k ;
y kC1
k D 0;1;:::;n 1;
(5.139)
with y 0 D 0. Here, t D 1=n,wheren>0is an integer. In Table 5.5 we have
listed the CPU time that is needed by a simple C program to compute y n
at time
t D 1 on a 600 MHz Pentium III processor.
From scheme ( 5.139 ), it is reasonable to assume that the CPU time, c.n/, can be
appropriately modeled using a linear function, i.e.,
c.n/ D ˛ C ˇn:
(5.140)
(a) Use the data in the table to determine ˛ and ˇ by the method of least squares.
(b) Estimate the CPU time needed in the cases of n D 10 6 and n D 10 7 .
˘
Exercise 5.4. Really big problems in scientific computing are solved by coupling
several computers together in a network. These computers have to exchange infor-
mation during the computation. The overall computing time thus depends on how
fast each computer does its job and how fast they are able to communicate with
each other. In this exercise, we will discuss a model of the communication speed.
Let us assume that we want to exchange vectors of real numbers (stored in double
precision) between a computer A and a computer B. The vector y has n entries.
Let T D T n be the time needed to send the vector y from A to B. Actually, we
send y first from A to B and then back to A. The cost of the “one-way” communi-
cation can be found by dividing the “round-trip” time by a factor 2. In this way we
 
Search WWH ::




Custom Search