1 Star 0 Fork 8

chamgj/NWPU-gem5-CSArch

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
README.org 5.62 KB
一键复制 编辑 原始数据 按行查看 历史

CS Arch Lab of NWPU

Introduction

This repo is for the course U10M11007 of NWPU, Computer Organization and Architecture, which partially supported by University-Industry Collaborative Education Program, Ministy of Education (Phytium-NWPU).

Lab experiment includes:

  1. ARM and RISCV Instructions & GEM5
  2. Debugging Trace and stats
  3. Cache Sub-System
  4. ARM Software Flow with GEM5 SE
  5. Out of Order Multi Instruction Parallelism

How to Use this repo

This repo includes 5 labs, which focus processor architecture using open-source simulator GEM5. The experiment of GEM5 is docker based.

Firstly, just clone https://gitee.com/nwpu-ercesi/nwpu-gem5-csarch.git to your local folder. If you use Linux or BSP liked System (such as MacOS), just follow this command line

git clone https://gitee.com/nwpu-ercesi/nwpu-gem5-csarch.git

Docker Container Image

Docker is a set of platform-as-a-service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating-system kernel and are thus more lightweight than virtual machines. In this lab project, Docker is adopted for GEM5 simulator. The image can be pull from the Docker resource repository.

docker pull gcr.io/gem5-test/ubuntu-20.04_all-dependencies:v22-0

Docker Registry Mirrors

As the understandable concern of the cyber security and the WWW resources is monopolized oversea, the Docker Hub presents the unacceptable laggy in China. The Registry mirrors which servers are located in China is a reasonable approache to speed up the PULL of image from Docker Hub.

Some userful information can be found at Zhihu. We recommand to register a personal Aliyun registry mirror and add it in the configuration file daemon.json.

{
    "registry-mirrors": [
        "https://alimirrorusername.mirror.aliyuncs.com"
    ]
}

Change the alimirrorusername to your registry username of Aliyun Docker mirror.

Build Docker Image from Dockerfile

As the gcr.io is laggy or banned for unkown reason, the Dockerfile is provided in this repo. The docker build command listed below will build the docker image which has the essential libraries of gem5. The command should be run in the dir which contains the Dockerfile, for example in our gitee repository dir.

docker build -t gem5-ercesi:latest .

How to Run Docker Container

f the Docker image has been imported, the Docker would run by the command below.

docker run -u $UID:$GID \
  --volume <gem5 directory>:/mnt/gem5arm \
  --rm -it gem5-ercesi:latest

In which, the the argument -i denotes an interactive mode of docker container execution, t implies a TTY prompt mode as while as bash is for a bash shell in command line. To keep the container clean, we recommand not to save any user file in container. So the --rm is added in the script to remove the container after exit. If you don’t use the --rm optional argument, please resume the opened container next time. <gem5 directory> in the run script is where the GEM5 source code downloaded. An example command below is for Windows users.

docker run -u gem5 --volume D://gem5_local:/mnt/gem5arm --rm -it gem5-ercesi:latest

Please note the performance of any app running in a docker container is limited by the resource assigned to the container. If any can be worked in the original OS, please do it in the original OS, such as doing git or compile in linux of mac os system.

The next step is cloning gem5 remote repo. It is recommande to use git clone from github or gitee.com.

git clone https://github.com/gem5/gem5.git

Note: Before compile the gem5, pre-commit libary is recommanded to install.

pip install pre-commit==2.20.0

Resume an Opened Container

When the end of the Docker lab, we use exit command to exit the Docker promot.

docker ps -a

To restart the seleceted container, docker start command can be used.

docker start [container ID]

If the run command used as that mentioned before, a sample command line is introdueced below.

docker exec -it [container ID] bash

Contributors

As this repo is transfered from the Inner Source, and all the old history is deleted due to the copyright consideration, the contributors of this repo are not listed in git configurations. We listed all contributors below.

Meng Zhang;

Hui Li;

Zhendi Yu

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/chamgj/nwpu-gem5-csarch.git
git@gitee.com:chamgj/nwpu-gem5-csarch.git
chamgj
nwpu-gem5-csarch
NWPU-gem5-CSArch
master

搜索帮助