make COMPILER=...
Compilers available: ARM
, CLANG
(default), CRAY
, GNU
, INTEL
.
You can specify additional options by setting ARCH
, CXX_<compiler>
, CXXFLAGS_<compiler>
, and LDFLAGS_<compiler>
.
Requirements:
- Meson (
pip3 install --user meson
) - Ninja
The default configuration builds with optimisations enabled:
env CXX=g++ meson build-gnu
cd build-gnu
ninja
The single ninja
invocation builds both the main executable and the tests wrapper, placing both in the build directory.
To build a debug (-Og -g3
) build:
env CXX=g++ meson --buildtype=debug build-debug-gnu
cd build-gnu
ninja
Only GNU and Clang have been tested, but Arm and Intel, and possibly Cray, should also work. On MacOS 10.14, there is an issue with the default linker command when using LLVM, which can be worked around by setting the linker version argument:
env CXX=clang++ LDFLAGS='-mlinker-version=450.3 -v' meson build-clang
On MacOS 10.14, not even Homebrew's LLVM's libc++ 10 accepts C++17 filesystem, so the tests can't be built; GCC 9 works fine. You can force using libstdc++ instead, for which the version shipped with GCC 9 works:
env CXX=clang++ CXXFLAGS='-stdlib=libstdc++ -I/usr/local/opt/gcc/include/c++/9.3.0 -I/usr/local/opt/gcc/include/c++/9.3.0/x86_64-apple-darwin18 -Wno-stdlibcxx-not-found' LDFLAGS='-L/usr/local/opt/gcc/lib/gcc/9 -mlinker-version=450.3' meson build-clang
./scs --help
Usage:
scs --binary [OPTIONS] -c CONFIG-FILE TRACE-FILE
scs --text [OPTIONS] -c CONFIG-FILE TRACE-FILE
scs --help
Options:
-b, --batch BATCH-FILE Treat all entries in BATCH-FILE as arguments to -c
Paths are relative to the batch file. May be specified more than once.
-c CONFIG-FILE The cache configuration file. Required at least once.
May be specified more than once for batch runs.
-f, --format {text,csv,both} Set the output format. Default: 'both' for single runs, 'csv' for batches.
-t, --timings Report run times of the main stages.
Basic usage involves passing a path to a cache hierarchy configuration file and a trace file to simulate:
./scs -c config.ini trace.log
The simulator support both text-encoded trace files and raw binary dumps. By default, the simulator will try to guess the encoding, but it's recommended you specify it manually:
./scs -c config.ini --text trace.log
./scs -c config.ini --binary trace.bin
A tool is provided to convert from text to binary traces:
./convert-trace -h
Reading binary traces is about 5x faster than parsing numbers from text.
The same trace can be run through several configurations with a single invocation:
./scs -c config1.ini -c config2.ini trace.bin # -c can be specified any number of times
./scs -b configs.batch trace.bin # batch files contain a path to a configuration file per line
The output format can be (more readable) text, CSV, or both:
./scs -c config.ini -f text trace.bin
./scs -c config.ini -f csv trace.bin
./scs -c config.ini -f both trace.bin
Plain text is the default when running a single configuration, whereas CSV is the default for batches.
Tests are implemented using Catch2, and the tests executable is the one generated by the library.
./scs-test
Cache configurations are read from ini files.
Some examples are provided in the configs
folder.
To define a single cache, don't use any sections in the ini file and define the parameters directly:
type = set_associative
cache_size = 32768
line_size = 64
set_size = 4
Alternatively, define it as a hierarchy with a single level:
[hierarchy]
levels = 1
[L1]
type = set_associative
cache_size = 32768
line_size = 64
set_size = 4
To define a hierarchy, first define the number of levels, then define the parameters for each level in a separate section named level<level-numer>
:
[hierarchy]
levels = 2
[L1]
type = set_associative
cache_size = 4096
line_size = 64
set_size = 4
[L2]
type = set_associative
cache_size = 32768
line_size = 64
set_size = 4