2019年8月
8月29日(木)
CentOSでgnuplotでunable to open DISPLAY的なこと言われるなぁ、と思ってたら、そもそもX11入ってなかった。
sudo yum -y groupinstall "X Window System"
8月27日(火)
Macにgem5を入れる。とりあえずclone。
git clone --depth 1 https://gem5.googlesource.com/public/gem5
ビルドにはsconsが必要なので入れる。
brew install scons
Python2系列じゃないと動かないようだ。
pyenv local anaconda2-4.4.0
scons build/X86/gem5.opt
sconsは、まずbuildを探すが、このディレクトリが存在しないためにbuild_opts
を探しに行く。するとそこにX86
があるので、それを参照しつつ、build
を作って、そこにgem5のバイナリを作る。
ビルドできたらか確認する。
$ ./build/X86/gem5.opt --version
gem5.opt 2.0
できたっぽい。
次、テスト。
$ ./build/X86/gem5.opt ./configs/example/se.py -c ./tests/test-progs/hello/bin/x86/linux/hello
gem5 Simulator System. http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.
gem5 compiled Aug 27 2019 12:23:47
gem5 started Aug 27 2019 12:27:22
gem5 executing on watanabe-iMac.local, pid 65602
command line: ./build/X86/gem5.opt ./configs/example/se.py -c ./tests/test-progs/hello/bin/x86/linux/hello
Global frequency set at 1000000000000 ticks per second
warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (512 Mbytes)
0: system.remote_gdb: listening for remote gdb on port 7000
**** REAL SIMULATION ****
info: Entering event queue @ 0. Starting simulation...
Hello world!
Exiting @ tick 5984000 because exiting with last active thread context
無事に実行できた。
次、Linuxで作ったバイナリを持ってくる。SEではdynamicリンクができないので、-staticをつける必要がある。
$ gcc test.c -static
/usr/bin/ld: -lc が見つかりません
collect2: エラー: ld はステータス 1 で終了しました
glibcのstaticリンク用ライブラリが必要。
sudo yum install glibc-static
gcc test.c -static
問題なくコンパイルできた。
./build/X86/gem5.opt ./configs/example/se.py -c a.out
gem5 Simulator System. http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.
gem5 compiled Aug 27 2019 12:23:47
gem5 started Aug 27 2019 12:35:48
gem5 executing on watanabe-iMac.local, pid 65827
command line: ./build/X86/gem5.opt ./configs/example/se.py -c a.out
Global frequency set at 1000000000000 ticks per second
warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (512 Mbytes)
0: system.remote_gdb: listening for remote gdb on port 7000
**** REAL SIMULATION ****
info: Entering event queue @ 0. Starting simulation...
My first md5
Exiting @ tick 6651000 because exiting with last active thread context
Simulated exit code not 0! Exit code is 13
実行できたぞ。最後にExit
codeについて文句言ってるけど、ちゃんとmain関数の最後でreturn 0;
すれば良い。
./build/X86/gem5.opt --debug-flags=O3PipeView --debug-file=trace.out configs/example/se.py --cpu-type=DerivO3CPU --caches -c ./a.out
ただprintfするだけでも7.8 MBのtrace.outが出力される。
./util/o3-pipeview.py -o pipeview.out --color m5out/trace.out
3万2千行(7.5MB)のpipeview.outが出力される。最後にless -r pipeview.out
すれば見える。
8月21日(水)
さくらのサーバ、Dockerを最新版にした。
ここに記述に従って、以下を順番に実行しただけ。
$ sudo yum remove docker \
\
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate docker-engine
sudo yum install -y yum-utils \
\
device-mapper-persistent-data lvm2
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
$ sudo yum install docker-ce docker-ce-cli containerd.io
$ sudo systemctl start docker
$ docker --version
Docker version 19.03.1, build 74b1e89
DockerのCommunity Edition (Docker-CE)が入った。
本当はDocker環境でLLVMいれていろいろためそうと思ったんだけど、やっぱり面倒になったのでそのままclangいれた。
sudo yum -y install clang
8月20日(火)
Macのsedが使いづらいので、/usr/local/binにあるgsedを、同じディレクトリでsedというシンボリックリンクを貼り、/usr/local/binを/usr/binより先に見に行くようにすることで、gsedを参照するようにした。