Re: [理工] [計組] performane

看板Grad-ProbAsk作者 (阿酣)時間12年前 (2012/06/30 22:59), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
有錯請指正。 ※ 引述《wsx02 ()》之銘言: : Function CPU time CPI : X 40% 2.5 : Y 30% 2 : Z 15% 1 : other 15% 3 : (1) : function X is very simple. So you re-write this function with an assembly code : You are able to reduce the instruction count of function X by 50% and reduce : the CPI of function X to 2. What is the speedup of the entire program? 先單純看 function X 所需的時間為 (instruction count) * (CPI) 。 所以改過的 function X 需要的時間是原本的 0.5 * (2 / 2.5) 倍 = 0.4 倍。 所以在原本程式當中佔 40% 時間的 function X 會變為只佔原本時間的 16% 。 新改過的程式執行時間會是原本程式的 (16 + 30 + 15 + 15) = 76% 。 整個程式的 speedup 是 1/0.76 = 1.316 。 : (2) : You look further into function X and found that the work in function X can be : handled easily by a digital signal processor(DSP). Suppose you can add such a : DSP into the system. What is the maximum speedup that the system can achieve : via this approach? 因為沒有講 DSP 到底有多快,問的又是最大 speedup , 所以就假定 function X 不花時間。 也就是原本的 40% 不見了,那麼 speedup 會是 1/0.6 = 1.67 。 : 請問有人會其中一題或兩題都會的嗎? : 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 1.169.122.198
文章代碼(AID): #1FxnHKYR (Grad-ProbAsk)