Introduction

At CMU we use this lab in place of the Performance Lab. Students write a general-purpose 
cache simulator, and then optimize a small matrix transpose kernel to minimize the number
of misses on a simulated cache. This lab uses the Valgrind tool to generate address traces.
Note: This lab must be run on a 64-bit x86-64 system.
在 CMU,我们使用这个实验室代替性能实验室。 学生编写一个通用缓存模拟器,然后优化一个小的
矩阵转置内核,以最大限度地减少模拟缓存上的未命中数。 本实验使用 Valgrind 工具生成地址跟踪。
注意:本实验必须在 64 位 x86-64 系统上运行。

一:Overview

This directory contains the files that you will need to run the CS:APP cache lab, which 
develops the student's understanding of caches.
In this lab, the student works on two C files called csim.c and
trans.c.  There are two parts: Part (a) involves implementing a cache
simulator in csim.c. Part (b) involves writing a function that
computes the transpose of a given matrix in trans.c, with the goal of
minimizing the number misses on a simulated cache.

Each time a student with login "foo" compiles their work, the Makefile
automatically generates a handin file, called foo-handin.tar, that
contains the csim.c and trans.c file. Students hand this tar file in
to the instructor.

The driver program (driver.py) evaluates the correctness of the cache
simulator in csim.c, and the performance and correctness of the
transpose functions in trans.c. See the writeup for details.

Requirements:
- The lab must be done on a 64-bit x86-64 system. 
- The driver requires a version of Valgrind (<http://valgrind.org>) that
supports the "--tool=lackey" option.
此目录包含运行 CS:APP 缓存实验室所需的文件,其中包括
培养学生对缓存的理解。
在本实验中,学生处理两个名为csim.c的C文件和trans.c的C文件. 他们由两部分构成:(a)部分: 涉及实
现一个在csim.c中的缓存模拟器. (b)部分: 在trans.c中计算给定矩阵的转置,目标是最大限度地减少
模拟缓存上的未命中数。

每次登录为“foo”的学生编译他们的作品时, Makefile自动生成一个包含csim.c和
trans.c名为foo-handin.tar的提交文件.学生交出这个tar文件给导师.

驱动程序(driver.py)评估csim.c中缓存模拟器的正确性,以及trans.c中转置函数的性能和正确性。
有关详细信息,请参阅撰写。

要求:
- 实验必须在 64 位 x86-64 系统上完成。
- 驱动程序需要一个版本的 Valgrind (<http://valgrind.org>)
支持“--tool=lackey”选项。

这次实验的任务很明确,就是制作自己的缓存系统,具体来说是实现一个缓存模拟器,根据给定的 trace 文件来输出对应的操作利用缓存机制加速矩阵转置的运算.

安装VALGRIND:sudo apt-get install -y valgrind

二. Files

Makefile		Makefile that builds the Lab
README			This file
archlab-handout/	The files handed out to the students
grade/			Autograding scripts
simguide/		CS:APP Guide to Simulators document
src/			Master distribution of the Y86-64 tools
sim/			Student distribution of the Y86-64 tools (subset of src)
writeup/		The architecture lab writeup

三:Building the Lab

To build the default version of the lab, modify the Latex lab writeup
in ./writeup/cachelab.tex for your environment. Then type the following
in the current directory:
        unix> make clean
        unix> make
This will build the cachelab-handout/ directory and its
cachelab-handout.tar archive that you can handout to students.
The command:
	unix> make dist DEST=<DIR>
will copy the tarfile and copies of the writeup to directory <DIR>,
where the students can access it.

四:Handing in the Lab

Each time a student with login "foo" compiles their work, the Makefile
automatically generates a handin file called foo-handin.tar. If you
want to autograde the handins, collect all of the student handin tar
files in the ./grade/handin directory.

五:Autograding the Lab

You can run the driver program manually on each student's handin, or
you can use the autograding scripts in ./grade to automatically grade
each of the .tar files in the handin/ directory.

See ./grade/README for instructions.
您可以在每个学生的handin 上手动运行驱动程序,或者
您可以使用 ./grade 中的自动评分脚本来自动评分
handin/ 目录中的每个.tar 文件

有关说明,请参阅 ./grade/README

六:Solve

lab讲义:http://www.cs.cmu.edu/afs/cs/academic/class/15213-f15/www/recitations/rec07.pdf