Stanford CS 149 2023 fall 课堂笔记 Lectrue 2
A Modern Multi-Core Processor下面的代码,表示正弦函数X[N]的terms阶泰勒展开实现: 1234567891011121314151617181920void sinx {int N, int terms, float* x, float* y){ for(int i=0; i<N; i++) { float value = x[i]; float numer = x[i]* x[i] *x[i]; int denom = 6; //3! int sign = -1; for(int j=1; j<=terms;j++) { value += sign * number /denom; numer *= x[i] * x[i]; denom *= (2*j+2) * (2*j+3); sign *=...
Stanford CS 149 2023 fall 课堂笔记 Lecture 1
Why Parallelism? Why Efficiency? What is a computer program?A programm is just a list of processor instructions!(指令集) A processor executes instructions处理器的简单抽象: Fetch/Decode : 负责读取指令ALU : 各类计算的执行的单元Execution Context: 程序涉及的各类变量的寄存器的状态 一个时钟周期执行一条指令 Superscalar processor(超级处理器)抽象图如下: 设计思路:例子如下程序以及编译后的指令集,完成该指令集只需要5个clock: <img src=”…/../../../image/Stanford_cs149_lec1/example.png”” weight=”100%” height=”100%” title=”picture description”...