CSCI 2321 (Computer Design), Spring 2021:
Homework 1
- Credit:
- 35 points.
Be sure you have read, or at least skimmed, the assigned readings
from Chapter 1.
Answer the following questions. You may write out your answers by
hand and scan them, or you may use a word processor
or other program, but please submit a PDF or plain text
via e-mail to my TMail address.
(No links to shared files on Google Drive please.)
Please use a subject line that mentions the course and
the assignment (e.g.,
“csci 2321 hw 1” or
“computer design hw 1”).
Tips:
- If a question requires you to do calculations,
please show enough work to help me understand how you got
the answer you did, so if you make a mistake I can give partial
credit for anything you did get right.
Also,
it's a good idea to apply to any result a “reasonableness
test” -- for example, if a processor's clock rate is
in the GHz range and it's executing a program with billions
of instructions, execution time is likely to be in the
range of a few seconds, and if it's different by a couple
of orders of magnitude you probably made a mistake!
End of tips
- (10 points)
Suppose two processors implement a given instruction set
architecture
in which the instructions can be grouped into four classes
A, B, C, and D.
Processor P1 has a clock rate of 2.5GHz,
and the CPIs (cycles per instruction) for the four classes
are 1, 2, 3, and 3 respectively.
Processor P2 has a clock rate of 3GHz and a CPI of 2 for
all classes.
Suppose a particular program at runtime executes 1E9 ()
instructions, of which
10% are class A,
20% class B,
50% class C,
and 20% class D.
Answer the following questions about this program:
- How many seconds does this program take on P1? on P2?
- If we define “global CPI” for a program as an
average CPI for the program (i.e., one that takes
into account the relative frequencies of
the different classes of instructions),
calculate global CPI for this program on both P1 and P2.
(So this value is probably best computed using the
total number of cycles and the total number of
instructions.)
- (15 points)
This question explores the effects of parallelism on execution time.
Suppose you have a system on which instructions are grouped into three categoris:
- Arithmetic, with a CPI of 1.
- Load/store, with a CPI of 12.
- Branch, with a CPI of 5.
and the clock frequency is 2GHz.
Suppose also you have a sequential (non-parallel) program that executes:
- 2.56E9 arithmetic instructions.
- 1.28E9 load/store instructions.
- 2.56 million branch instructions.
(E9 indicates multiplication by ())
and a parallel version of the same program that can take advantage of
multiple cores.
This parallel version must execute the same number of branch instructions,
but counts for the other two groups of instructions are counts for the
sequential version divided by
, where is the number of
cores/processors.
Answer the following questions about these programs:
- What is the execution time for the sequential version?
- What are execution times for the parallel version running on
1, 2, 4, and 8 cores?
- What are speedups (defined as parallel time divided by sequential time)
for 1, 2, 4, and 8 cores?
- What would happen if the clock rate were changed
to 2.5GHz but arithmetic instructions now had
a CPI of 2? (Recalculate all times and speedups.)
- Optional: For up to 2 extra-credit points,
plot the calculated speedups
and a line showing what linear speedup would look like.
(If you don't already have a favorite program
for making plots, ask me about gnuplot.)
Suggestion:
The calculations here are pretty tedious.
I really suggest that you write a short throw-away program to help you,
in whatever language appeals to you.
If you do, when you e-mail me your answers, attach a
a copy of your source code;
that will be the equivalent of “showing your work”.
- (10 points)
The text observes that it can be a mistake to focus on only
one or two of the three variables that define execution time
and assume this subset tells you which is faster.
Suppose you have two systems:
- P1, with clock rate 4GHz and average CPI of 0.9.
- P2, with clock rate 3GHz and average CPI of 0.75.
and a program that on P1 requires 5E9 instructions and
on P2 requires 1E9 instructions.
Answer the following questions about this scenario:
- What are execution times for this program on both systems?
- Is it true that the system with the highest clock rate performs better?
- Is it true that the system that executes more instructions
performs worse?
- If you define MIPS rate
(millions of instructions per second) as number of
executions divided by time,
what is the MIPS rate for this program on both systems?
Is it true that the system with the higher MIPS rate performs better?
For programming assignments, this section should go in the body of the e-mail
or in a plain-text file pledge.txt (no word-processor files
please).
For written assignments, please put it in the text or PDF file with
your answers.
Include the Honor Code pledge or just the word “pledged”,
plus at least one of the following about
collaboration and help (as many as apply).
Text in italics is explanatory or something for you to
fill in.
- I did not get outside help aside from course
materials, including starter code,
readings, sample programs, the instructor.
- I worked with names of other students on this
assignment.
- I got help with this assignment from
source of help -- ACM
tutoring, another student in the course, etc.
(Here, “help” means significant help,
beyond a little assistance with tools or compiler errors.)
- I got help from outside source --
a book other than the textbook (give title and author),
a Web site (give its URL), etc..
(Here too, you only need to mention significant help --
you don't need to tell me that you
looked up an error message on the Web, but if you found
an algorithm or a code sketch, tell me about that.)
- I provided help to names of students on this
assignment.
(And here too, you only need to tell me about
significant help.)
For programming assignments, this section should go in the body of the e-mail
or in a plain-text file pledge.txt (no word-processor files
please).
For written assignments, please put it in the text or PDF file with
your answers.
Include a brief essay (a sentence or two is fine, though you can write
as much as you like) telling me what if anything you think
you learned from the assignment, and what if anything you found
interesting, difficult, or otherwise noteworthy.
2021-02-05