Git Product home page Git Product logo

cachelab's Introduction

Cache Lab

Introduction

ICS Cache Lab, Peking University.

This lab will help you understand the impact that cache memories can have on the performance of your C programs.

The lab consists of two parts. In the first part you will write a small C program (about 200-300 lines) that simulates the behavior of a hardware cache memory. In the second part, you will optimize a small matrix transpose function, with the goal of minimizing the number of cache misses.

For more information about this lab, please refer to cachelab.pdf.

Installation

It is recommended to do this lab on Ubuntu 22.04.

Before getting your hands dirty, a Linux program called valgrind will be doing you a great deal of things. You can type the following command to install valgrind.

sudo apt install valgrind

Score

My score for this lab is as follows.

Total score Total misses Misses (32×32) Misses (64×64) Misses (60×68)
53.0 2682 256 1024 1402

The miss counts of transposing 32×32 and 64×64 matrices are theoretically optimal. The best miss count of transposing a 60×68 matrix in my class is 1382.

Auto-search Tool

I have written a tool in parameter auto-search.cpp to automatically calculate the miss counts of different transpose methods. All you have to do is to write your transpose function in transpose_submit using load and store.

If you have some parameters in your transpose function, you can search for the best parameters automatically using this tool. I have given an example in parameter auto-search.cpp. Moreover, this tool enables more advanced approach, such as heuristic search and even neural networks.

Another powerful feature of this tool is that by setting print_codes = true, it prints out the corresponding C code of your method, which you can paste to trans.c and submit directly. This feature may come in handy if you are using more advanced approaches.

cachelab's People

Contributors

georgemlp avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.