...
 
Commits (5)
#!/usr/bin/env bash
# The actual binary we substitute is the first argument
BINARY=${1}
shift
# All other options are supplied by the calling context
while test $# -gt 0
do
case ${1} in
-c) # Compile artifacts - e.g. do nothing
exit 0
;;
-o) # Remember the outfile in case we link
shift
OUTFILE=${1}
;;
*) # Just ignore other options
;;
esac
shift
done
#echo ${BINARY}
#echo ${OUTFILE}
cp ${BINARY} ${OUTFILE}
......@@ -71,6 +71,16 @@ parser.add_argument("--fortran-compiler", metavar="FC", default="gfortran",
parser.add_argument("--cpp-compiler", metavar="CXX", default="g++",
help="Use CXX to build benchmark programs, default=g++")
parser.add_argument("--c-compiler-version-option", metavar="FLAG", default=["--version"], action="append",
help="Flag that causes the CC to print its version, default=--version")
parser.add_argument("--cpp-compiler-version-option", metavar="FLAG", default=["--version"], action="append",
help="Flag that causes the CXX to print its version, default=--version")
parser.add_argument("--fortran-compiler-version-option", metavar="FLAG", default=["--version"], action="append",
help="Flag that causes the FC to print its version, default=--version")
parser.add_argument("-j", "--jobs", metavar="N", action="append", default="",
help="The number of parallel build jobs, default: '' (unbounded degree of parallelism)")
parser.add_argument("--compiler-args", metavar="FLAGS", default=["-O3"], action="append",
help="Append FLAGS to build benchmark programs for all compilers, default=-O3")
parser.add_argument("--c-compiler-args", metavar="CFLAGS", default=[], action="append",
......@@ -167,6 +177,7 @@ i686_flags = dict()
i686_flags["186.crafty"] = "-DLINUX_i386"
i686_flags["253.perlbmk"] = "-DSPEC_CPU2000_LINUX_I386"
i686_flags["400.perlbench"] = "-DSPEC_CPU_LINUX_IA32"
i686_flags["600.perlbench"] = "-DSPEC_LINUX_IA32"
TARGET_ARCH_FLAGS["i686"] = i686_flags
x86_64_flags = defaultdict(str)
......@@ -176,9 +187,12 @@ x86_64_flags["253.perlbmk"] = "-DSPEC_CPU2000_LP64 -DHAS_LONG_LONG -DSPEC_CPU200
x86_64_flags["254.gap"] = "-DSPEC_CPU2000_LP64"
x86_64_flags["255.vortex"] = "-DSPEC_CPU2000_LP64"
x86_64_flags["400.perlbench"] = "-DSPEC_CPU_LINUX_X64"
x86_64_flags["600.perlbench"] = "-DSPEC_LINUX_IA64"
for bench in ["400.perlbench", "403.gcc", "436.cactusADM", "453.povray",
"481.wrf"]:
x86_64_flags[bench] += " -DSPEC_CPU_LP64"
for bench in ["600.perlbench", "603.gcc"]:
x86_64_flags[bench] += " -DSPEC_LP64"
TARGET_ARCH_FLAGS["x86_64"] = x86_64_flags
sparc_flags = dict()
......@@ -202,6 +216,7 @@ COMPILER_FLAGS["clang"] = clang_flags
gcc_flags = dict()
gcc_flags["254.gap"] = "-fwrapv"
gcc_flags["602.gcc"] = "-fgnu89-inline" # Or -std=gnu89. See https://www.spec.org/cpu2017/Docs/benchmarks/602.gcc_s.html
COMPILER_FLAGS["gcc"] = gcc_flags
......@@ -363,6 +378,20 @@ setprocgroup = yes
ignore_sigint = no
test_sponsor = IPD Snelting
"""
"""
Program names may end with a _s or _t suffix.
If a dictionary doesn't contain an entry for those specific keys, we want
to trim that suffix from the program name and try again.
"""
def get_by_prog(d, prog, default=None):
if prog in d:
return d[prog]
suf = prog.rfind("_")
if suf >= 0:
return d.get(prog[:suf], default)
return default
def get_portability(options, prog, lang):
if lang == "c":
port = "CPORTABILITY"
......@@ -380,18 +409,19 @@ def get_portability(options, prog, lang):
target_arch = options.target_architecture
compat_flags = COMPATIBILITY_FLAGS.get(prog, "")
compat_flags = get_by_prog(COMPATIBILITY_FLAGS, prog, "")
if not TARGET_ARCH_FLAGS.has_key(target_arch):
print "No architecture-dependent flags defined for architecture '%s'" % target_arch
exit(1)
target_flags = TARGET_ARCH_FLAGS[target_arch].get(prog, "")
target_flags = get_by_prog(TARGET_ARCH_FLAGS[target_arch], prog, "")
compiler_flags = ""
for comp in COMPILER_FLAGS:
if comp in compiler: # Also allow stuff like sparc-leon-linux-gnu-gcc or cparser-test
compiler_flags = COMPILER_FLAGS[comp].get(prog, "")
compiler_flags = get_by_prog(COMPILER_FLAGS[comp], prog, "")
break
# filter(None, list) == filter(id, list)
flags = ' '.join(filter(None, [compat_flags, target_flags, compiler_flags]))
if flags == '':
return None
......@@ -412,26 +442,27 @@ def generate_spec_config(options, progs):
if SPEC_SUITE != "SPEC CPU2017":
contents.append("tester_name = IPD Snelting")
contents.append("company_name = Karlsruhe Institute of Technology KIT")
contents.append("prepared_by = spec.py script")
contents.append("prepared_by = spec.py script")
contents.append("")
contents.append("## just assuming:")
if SPEC_SUITE != "SPEC CPU2017":
contents.append("hw_fpu = Integrated")
contents.append("sw_state = Multi-user")
contents.append("sw_state = Multi-user")
if options.build_only:
contents.append("action = build")
else:
contents.append("action = validate") # includes run
contents.append("runlist = %s" % (" ".join(progs)))
contents.append("iterations = %d" % int(options.iterations))
if SPEC_SUITE != "SPEC CPU2006":
if SPEC_SUITE != "SPEC CPU2006" and SPEC_SUITE != "SPEC CPU2017":
contents.append("test_date = %s" % datetime.now())
contents.append("")
contents.append("sw_os = %s %s %s" % (LINUX_NAME, LINUX_VERSION, LINUX_CODENAME))
contents.append("sw_compiler1 = %s" % get_compiler_version(options.c_compiler))
contents.append("sw_compiler2 = %s" % get_compiler_version(options.cpp_compiler))
contents.append("sw_compiler3 = %s" % get_compiler_version(options.fortran_compiler))
contents.append("sw_file = %s" % path_to_filesystem("."))
if SPEC_SUITE != "SPEC CPU2017":
contents.append("sw_file = %s" % path_to_filesystem("."))
assert int(BITSIZE), "bitsize is "+BITSIZE
contents.append("sw_base_ptrsize = %d-bit" % BITSIZE)
contents.append("sw_peak_ptrsize = %d-bit" % BITSIZE)
......@@ -447,7 +478,7 @@ def generate_spec_config(options, progs):
contents.append("hw_ncpu = %d" % cores)
if SPEC_SUITE != "SPEC CPU2017":
contents.append("hw_cpu_mhz = %s" % cpuinfo.get("cpu MHz", "?"))
contents.append("hw_nchips = %d" % chips)
contents.append("hw_nchips = %d" % chips)
if SPEC_SUITE != "SPEC CPU2017":
contents.append("hw_ncoresperchip = %d" % cores_per_chip)
contents.append("hw_vendor = %s" % cpuinfo.get("vendor_id", "?"))
......@@ -466,9 +497,15 @@ def generate_spec_config(options, progs):
contents.append("use_submit_for_speed = 1")
contents.append("submit = %s" % submit)
contents.append("")
contents.append("makeflags = -j%s" % options.jobs)
contents.append("CC = %s" % options.c_compiler)
contents.append("CXX = %s" % options.cpp_compiler)
contents.append("FC = %s" % options.fortran_compiler)
contents.append("CC_VERSION_OPTION = %s" % options.c_compiler_version_option)
contents.append("CXX_VERSION_OPTION = %s" % options.cpp_compiler_version_option)
contents.append("FC_VERSION_OPTION = %s" % options.fortran_compiler_version_option)
contents.append("")
contents.append("notes%03d = machine: %s" % (notes, socket.getfqdn()))
notes += 1
......@@ -498,7 +535,7 @@ def generate_spec_config(options, progs):
if prog in progs:
port = get_portability(options, prog, lang)
if port is not None:
contents.append(prog + "=default=default=default:")
contents.append(prog + ":")
contents.append(port)
contents.append("notes%03d = %s: %s" % (notes, prog, port))
notes = notes + 1
......