自動車産業系、ファイル圧縮・展開、ネットワーク系、
文書処理、セキュリティ、通信
等に関する多くのプログラムを含む。Linux を例に SPEC CPU2000 ベンチマークのインストール手順と簡単な使い方 を説明する。
gcc や JDK, COINS など必要なプログラムはすでにインストールされているも のとして説明を行う。
以下のパス名を前提とする。
COINS ディレクトリ: ~/coins/coins-バージョン番号 SPEC CPU2000 のインストール先: ~/spec-bench/cpu2000
なお、具体的な実行コマンドの例は Linux (Debian 6.0, 32bit) 上で作成して いる。
基本的には SPEC CPU2000 のメディアを mount して、インストーラ install.sh を実行すれば良い。
-- 実行例
# su # mount /dev/scd0 /media/cdrom0/ ←デバイス名、マウントポイントは適宜読み替えのこと # exit $ cd /media/cdrom0/ $ ./install.sh
SPEC CPU2000 Installation Top of the CPU2000 tree is '/media/cdrom0' Enter the directory you wish to install to (e.g. /usr/cpu2000) /home/username/spec-bench/cpu2000 ←入力する
There appears to be only one valid toolset:
linux-redhat62-ia32 For x86-based Linux systems with GLIBC 2.1.3+
tail: cannot open `+2' for reading: No such file or directory
==> /media/cdrom0/tools/bin/linux-redhat62-ia32/description <==
For x86-based Linux systems with GLIBC 2.1.3+
Built on RedHat 6.2 with gcc 2.95.2
Use this? (y/n)
y ←入力する
These appear to be valid architectures: solaris-sparc solaris8-sparc Enter the architecture you are using: solaris-sparc ←コピーアンドペーストする
インストールが正常に行われたことを確認するため gcc を使用してベンチマー クを実行する。
C 言語のベンチマークには以下のものがある。
CINT2000 (整数) 164.gzip 175.vpr 176.gcc 181.mcf 186.crafty 197.parser 253.perlbmk 254.gap 255.vortex 256.bzip2 300.twolf CFP2000 (浮動小数) 177.mesa 179.art 183.equake 188.ammp
上記をすべてテストするには以下のように実行すれば良い。
$ cd ~/spec-bench/cpu2000 $ . shrc $ runspec -c linux-x86-gcc.cfg --size test --no-reportable int ^eon 177 179 183 188
Success: 3x164.gzip 3x175.vpr 3x176.gcc 3x177.mesa 3x179.art 3x181.mcf 3x183.equake 3x186.crafty 3x188.ammp 3x197.parser 3x253.perlbmk 3x254.gap 3x255.vortex 3x256.bzip2 3x300.twolf
gcc での test 実行に成功したら、通常使用するための COINS 用のコンフィグ ファイルを作成する。
$ cd ~/spec-bench/cpu2000/config $ cp linux-x86-gcc.cfg coins-tmp.cfg
coins-tmp.cfg を以下のように編集する。(設定項目の意味については ~/spec-bench/cpu2000/doc/config を参照のこと。)
-- 例
reportable = 0 backup_config = 0 CC = java -Xmx512m -cp /home/username/coins/coins-バージョン番号/classes/ coins.driver.Driver -coins:target=x86,assembler=as -I/home/username/coins/coins-バージョン番号/lang/c/include
-- ここまで
作成したコンフィグファイルを試すには以下を実行する。(比較的問題なくコン パイルできる 256.bzip2 と 179.art を実施している。)
$ runspec -c coins-tmp --size test -n 1 --rebuild 256 179
普段は上記で作成した coins-tmp.cfg を使用してテストを行うが、特定のバー ジョンや最適化オプションでの記録を残したい場合には、別途コンフィグファ イルを作成してベンチマークを実行した方が良い。
以下、例として coins-1.4.4.5 で -O3 の最適化を行った場合を挙げる。
$ cd ~/spec-bench/cpu2000/config $ cp coins-tmp.cfg coins-1.4.4.5-o3.cfg-- 例
reportable = 0 backup_config = 1 CC = java -Xmx512m -cp /home/username/coins/coins-1.4.4.5/classes/ coins.driver.Driver -coins:target=x86,assembler=as -I/home/username/coins/coins-1.4.4.5/lang/c/include -O3
-- ここまで
前項と重複するがベンチマークの実行方法を簡単に示す。
$ cd ~/spec-bench/cpu2000 $ . ./shrc
上記は最初に一度だけ実行すれば良い。
$ runspec -c coins-tmp -n 1 181 197 183
$ runspec -c coins-tmp --size test 181 197 183
$ runspec -c coins-1.4.4.5-o3 --rebuild 181 197 183
なお、ベンチマークの結果は ~/spec-bench/cpu2000/result に作られる。(実 行後にファイル名が表示される。)
runspec の詳しい使い方は ~/spec-bench/cpu2000/docs/runspec.txt を参照のこと。
arm や mips のようなあまり一般的ではない環境の場合には、インストーラは ホスト環境を認識できないし、認識できたとしてもコンパイル済みバイナリが 用意されていない。
このような場合、以下のようなメッセージが表示されるので yes と入力すれば、 ベンチマークテストの実行に必要なコマンド類をソースからビルドすることを 試みてくれる。(ただしうまくいくとは限らない。Makefile にかなり手をいれ ないといけない場合があった。)
-- ここから
We do not appear to have vendor supplied binaries for your architecture. You will have to compile the tool binaries by yourself. Please read the file /home/username/spec-bench/cpu2000/docs/tools_build.txt and then try the following. If you wish I can try to perform these steps for you. However I'm not very intelligent so if anything goes wrong I'm just going to stop. Want me to try? (yes/no) yes ←入力する
-- ここまで
Linux 上で COINS を使用して SPEC CPU2000 ベンチマークを実行する場合 glibc のヘッダファイルが原因でコンパイルがエラーになってしまうことがあ る。
この問題には以下の二つ要因がある。
この問題に関しては __GNUC__ で始まるシンボルを undef することで解決する ことがある。
また 253.perlbmk に関しては、上記とは別に offsetof マクロを使用している という問題がある。Linux で使用されている offsetof マクロは gcc の付属ヘッ ダで定義されているため gcc 専用となっているので COINS 用のマクロを作成 して差し替える必要がある。
具体的には以下の通り。
$ gcc -E -dM -x c /dev/null | grep GNU
#define __GNUC_PATCHLEVEL__ 5
#define __GNUC__ 4
#define __GNUC_MINOR__ 4
#define __GNUC_GNU_INLINE__ 1
-- /home/username/coins/include/x86/stddef.h #include <features.h> /* include gcc header first. */ #undef offsetof #define __need_ptrdiff_t #define __need_wchar_t #define __need_size_t #define __need_wint_t #include "/usr/lib/gcc/i486-linux-gnu/バージョン/include/stddef.h" /* バージョンには使用する gcc のバージョンを指定する */ /* redefine offsetof macro */ #undef offsetof #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -- end
-- 例
CC = java -Xmx512m -cp /home/username/coins/coins-バージョン番号/classes/ coins.driver.Driver -coins:target=x86,preprocessor=cpp,assembler=/usr/bin/as -D_POSIX_SOURCE -U__GNUC__ -U__GNUC_MINOR__ -U__GNUC_GNU_INLINE__ -U__GNUC_PATCHLEVEL__ -D__GLIBC_HAVE_LONG_LONG=1 -I/home/username/coins/include/x86 -I/home/username/coins/coins-バージョン番号/lang/c/include
-- ここまで
$ runspec -c coins-1445 int ^eon 177 179 183 188 -I
runspec v1585 - Copyright 1999-2005 Standard Performance Evaluation Corporation
Loading standard modules.............
Loading runspec modules.............
Identifying output formats...asc...config...html...pdf...ps...raw...
'252.eon' removed
We will use: 164.gzip, 175.vpr, 176.gcc, 181.mcf, 186.crafty, 197.parser, 253.perlbmk, 254.gap, 255.vortex, 256.bzip2, 300.twolf, 177.mesa, 179.art, 183.equake, 188.ammp
Compiling Binaries
Building 164.gzip ref base coins-1445 default
: 中略 :
Setting Up Run Directories
Setting up 164.gzip ref base coins-1445 default: existing
Setting up 175.vpr ref base coins-1445 default: existing
Setting up 176.gcc ref base coins-1445 default: existing
Setting up 181.mcf ref base coins-1445 default: existing
Setting up 186.crafty ref base coins-1445 default: existing
Setting up 197.parser ref base coins-1445 default: existing
Setting up 253.perlbmk ref base coins-1445 default: existing
Setting up 254.gap ref base coins-1445 default: existing
Setting up 255.vortex ref base coins-1445 default: created
Setting up 256.bzip2 ref base coins-1445 default: existing
Setting up 300.twolf ref base coins-1445 default: existing
Setting up 177.mesa ref base coins-1445 default: existing
Setting up 179.art ref base coins-1445 default: existing
Setting up 183.equake ref base coins-1445 default: existing
Setting up 188.ammp ref base coins-1445 default: existing
Running Benchmarks
Running 164.gzip ref base coins-1445 default
Running 164.gzip ref base coins-1445 default
Running 164.gzip ref base coins-1445 default
Running 175.vpr ref base coins-1445 default
: 中略 :
Error: 3x176.gcc
Success: 3x164.gzip 3x175.vpr 3x177.mesa 3x179.art 3x181.mcf 3x183.equake 3x186.crafty 3x188.ammp 3x197.parser 3x253.perlbmk 3x254.gap 3x255.vortex 3x256.bzip2 3x300.twolf
Producing Reports
mach: default
ext: coins-1445
size: ref
set: int
format: raw -> /home/username/spec-bench/cpu2000/result/CINT2000.068.raw
format: ASCII -> /home/username/spec-bench/cpu2000/result/CINT2000.068.asc
format: HTML -> /home/username/spec-bench/cpu2000/result/CINT2000.068.html
format: config -> /home/username/spec-bench/cpu2000/result/CINT2000.068.cfg
set: fp
format: raw -> /home/username/spec-bench/cpu2000/result/CFP2000.068.raw
format: ASCII -> /home/username/spec-bench/cpu2000/result/CFP2000.068.asc
format: HTML -> /home/username/spec-bench/cpu2000/result/CFP2000.068.html
format: config -> /home/username/spec-bench/cpu2000/result/CFP2000.068.cfg
runspec finished