Computer composition and design work01(1.6-1.9)——fifth verson

本文探讨了不同处理器性能指标(如CPI和时钟速率)对程序执行效率的影响,比较了不同编译器对执行时间和CPI的贡献,并分析了电力消耗与技术改进的关系。通过实例计算展示了并行化对性能的影响和CPI变化对执行时间的效应。
摘要由CSDN通过智能技术生成

1.6

[20] <§1.6> Consider two diff erent implementations of the same instruction
set architecture. Th e instructions can be divided into four classes according to
their CPI (class A, B, C, and D). P1 with a clock rate of 2.5 GHz and CPIs of 1, 2, 3,
and 3, and P2 with a clock rate of 3 GHz and CPIs of 2, 2, 2, and 2.

Given a program with a dynamic instruction count of 1.0E6 instructions divided
into classes as follows: 10% class A, 20% class B, 50% class C, and 20% class D,
which implementation is faster?

a. What is the global CPI for each implementation?

b. Find the clock cycles required in both cases.

C P I 1 = 1 × 10 % + 2 × 20 % + 3 × 50 % + 3 × 20 % = 2.6 C P I 2 = 2 × 10 % + 2 × 20 % + 2 × 50 % + 2 × 20 % = 2 CPI_1 = 1 \times 10\% + 2\times20\%+3\times 50\%+3\times20\%=2.6\\CPI_2 = 2 \times 10\% + 2\times20\%+2\times 50\%+2\times20\%=2 CPI1=1×10%+2×20%+3×50%+3×20%=2.6CPI2=2×10%+2×20%+2×50%+2×20%=2

c l o c k   c y c l e = C P I × I n s t r u c t i o n s   f o r   a   p r o g r a m C P U 时 钟 周 期 数 = 程 序 指 令 数 × 指 令 平 均 周 期 数 clock\ cycle = CPI\times Instructions\ for\ a\ program\\ CPU时钟周期数 = 程序指令数 \times 指令平均周期数 clock cycle=CPI×Instructions for a programCPU=×

T 1 = 2.6 × 1.0 × 1 0 6 = 2.6 × 1 0 6 T 2 = 2 × 1.0 × 1 0 6 = 2 × 1 0 6 T_1 = 2.6\times 1.0\times 10^6 = 2.6\times 10^6\\ T_2 = 2\times 1.0\times 10^6 = 2\times 10^6 T1=2.6×1.0×106=2.6×106T2=2×1.0×106=2×106

1.7

[15] <§1.6> Compilers can have a profound impact on the performance
of an application. Assume that for a program, compiler A results in a dynamic
instruction count of 1.0E9 and has an execution time of 1.1 s, while compiler B
results in a dynamic instruction count of 1.2E9 and an execution time of 1.5 s.

a. Find the average CPI for each program given that the processor has a clock cycle
time of 1 ns.

C P I = C P U 时 钟 周 期 数 程 序 指 令 数 = C P U 执 行 时 间 时 钟 周 期 长 度 × 程 序 指 令 数 CPI = \frac{CPU时钟周期数}{程序指令数} = \frac{CPU执行时间}{时钟周期长度\times 程序指令数} CPI=CPU=×CPU

C P I A = 1.1 ( 1.0 × 1 0 − 9 ) ( 1.0 × 1 0 9 ) = 1.1 CPI_A=\frac{1.1}{(1.0\times10^{-9})(1.0\times 10^{9})} = 1.1 CPIA=(1.0×109)(1.0×109)1.1=1.1
C P I B = 1.5 ( 1.0 × 1 0 − 9 ) ( 1.2 × 1 0 9 ) = 1.25 CPI_B=\frac{1.5}{(1.0\times10^{-9})(1.2\times 10^{9})} = 1.25 CPIB=(1.0×109)(1.2×109)1.5=1.25

b. Assume the compiled programs run on two diff erent processors. If the execution
times on the two processors are the same, how much faster is the clock of the
processor running compiler A’s code versus the clock of the processor running
compiler B’s code?

F a s t e r = T I M E B T I M E A = 1.5 1.1 = 1.363 Faster = \frac{TIME_B}{TIME_A}=\frac{1.5}{1.1} = 1.363 Faster=TIMEA

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值