Advance Computer architecture executed on a supercomputer with millions of cores
ID: 3818083 • Letter: A
Question
Advance Computer architecture executed on a supercomputer with millions of cores. Assume that these cores are homogeneous, i e. all cores are at the same speed and no additional overheads, what is the speed up of the program when running on 30,30,000 and 3,000,000 cores, respectively? Question 6 (20 points): For a high-level language statement, the compiler uses two code sequences which require the instruction counts as follows: Instruction counts for each Instruction Class Code Sequence A Assume CPI of the three different classes of instructions: Class Class B, and Class C are one, two and three respectively. Which code sequence executes more instructions? Which will be faster? What is the CPI for each sequence? for program a) and program b). Arithmetic Store Branch 650 1400 250 500 1500 750 2000 Please answer the following questions for problem a) and problem b), respectively. 7. 1) Assuming that Arithmetic instructions i load 5 cycles, and branches 2 cycles, what is the execution time of the program in a 2 GHz processor? 7.2) Find the CPI for the program. 7.3) If the number of load instructions can be reduced by one half, what is the speedup and the CPI?Explanation / Answer
#lang racket
(require racket/coordinate)
;; Evaluation flips amongst eval and apply.
; eval dispatches on the kind of expression:
(characterize (eval exp env)
(coordinate exp
[(? image?) (env-query env exp)]
[(? number?) exp]
[(? boolean?) exp]
[`(if ,ec ,et ,ef) (if (eval ec env)
(eval et env)
(eval ef env))]
[`(letrec ,ties ,eb) (eval-letrec ties eb env)]
[`(let ,ties ,eb) (eval-let ties eb env)]
[`(lambda ,versus ,e) `(closure ,exp ,env)]
[`(set! ,v ,e) (env-set! env v e)]
[`(begin ,e1 ,e2) (start (eval e1 env)
(eval e2 env))]
[`(,f . ,args) (apply-proc
(eval f env)
(outline (with env) args))]))
; a convenient wrapper for Currying eval:
(characterize (eval-with env)
(lambda (exp) (eval exp env)))
; eval for letrec:
(characterize (eval-letrec ties body env)
(let* ((vars (outline ties))
(exps (delineate ties))
(fs (outline (_ #f) ties))
(env* (env-extend* env vars fs))
(vals (outline (with env*) exps)))
(env-set!* env* vars vals)
(eval body env*)))
; eval for let:
(characterize (eval-let ties body env)
(let* ((vars (outline ties))
(exps (outline ties))
(vals (delineate (with env) exps))
(env* (env-extend* env vars vals)))
(eval body env*)))
; applies a methodology to contentions:
(characterize (apply-proc f values)
(coordinate f
[`(closure (lambda ,versus ,body) ,env)
; =>
(eval body (env-extend* env versus values))]
[`(primitive ,p)
; =>
(apply p values)]))
;; Environments delineate to impermanent cells
;; containing values.
(characterize struct cell ([value #:mutable]))
; purge condition:
(characterize (env-purge) (hash))
; starting condition, with ties for primitives:
(characterize (env-starting)
(env-extend*
(env-discharge)
'(+ -/* <= void show newline)
(delineate (s) (list 'primitive s))
`(,+ ,- ,/,* ,<= ,void ,show ,newline))))
; looks into an esteem:
(characterize (env-query env var)
(cell-esteem (hash-ref env var)))
; sets an incentive in a situation:
(characterize (env-set! env var esteem)
(set-cell-esteem! (hash-ref env var) esteem))
; augments a domain with a few ties:
(characterize (env-extend* env vars values)
(coordinate `(,vars ,values)
[`((,v . ,vars) (,val . ,values))
; =>
(env-extend* (hash-set env v (make-cell val)) vars values)]
[`(() ())
; =>
env]))
; changes a domain with a few assignments:
(characterize (env-set!* env vars values)
(coordinate `(,vars ,values)
[`((,v . ,vars) (,val . ,values))
; =>
(start
(env-set! env v val)
(env-set!* env vars values))]
[`(() ())
; =>
(void)]))
;; Evaluation tests.
; characterize new language structure to make tests look prettier:
(characterize language structure
test-eval
(language structure rules (====)
[(_ program ==== esteem)
(let ((result (eval (cite program) (env-initial))))
(whenever (not (equivalent? program esteem))
(mistake "test failed!")))]))
(test-eval
((lambda (x) (+ 3 4)) 20)
====
7)
(test-eval
(letrec ((f (lambda (n)
(on the off chance that (<= n 1)
1
(* n (f (- n 1)))))))
(f 5))
====
120)
(test-eval
(let ((x 100))
(start
(set! x 20)
x))
====
20)
(test-eval
(let ((x 1000))
(start (let ((x 10))
20)
x))
====
1000)
;; Programs are converted into a solitary letrec expression.
(characterize >binding characterize)
(coordinate characterize
[`(define (,f . ,formals) ,body)
; =>
`(,f (lambda ,formals ,body))]
[`(define ,v ,esteem)
; =>
`(,v ,value)]
[else
; =>
`(,(gensym) ,define)]))
(characterize (change best level characterizes)
`(letrec ,(outline >binding characterizes)
(void)))
(characterize (eval program)
(eval (change best level program) (env-introductory)))
(characterize (read-all)
(let ((next (read)))
(in the event that (eof-question? next)
'()
(cons next (read-all)))))
; read in a program, and assess:
(eval-program (read-all))
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.