def c_config(inputs_per_category: InputsPerCategory, optimisation: str = "-O2", clang_version = "3.7") -> ConfigDict:
"""
Generates a game config that compares gcc and clang.
"""
def cat(category: str, numbers: t.List[int] = None):
return bench_category(category, "gcc", inputs_per_category[category], numbers)
config = {
"language": "c",
"categories": [
cat("binarytrees"),
cat("chameneosredux", [2]),
cat("fannkuchredux", [1, 5]),
cat("fasta", [1, 4, 5]),
cat("fastaredux"),
#cat("knucleotide", "gcc", [9]) # doesn't compile
cat("mandelbrot", [1, 2, 3, 4, 6, 9]),
cat("meteor"),
cat("nbody"),
cat("pidigits"),
#cat("regexdna", "gcc", [1, 2]), # runs almost infinitely
cat("revcomp", [1]),
cat("spectralnorm", [1]),
cat("threadring")
],
"impls": [
{
"name": "gcc", # todo: tcl8.6 vs 8.4???
"build_cmd": "cp {file} {bfile}.c; gcc {bfile}.c $O -I/usr/include/tcl8.6 -ltcl8.4 -lglib-2.0 -lgmp "
"-D_GNU_SOURCE -Doff_t=__off64_t -fopenmp -D_FILE_OFFSET_BITS=64 -I/usr/include/apr-1.0 "
"-lapr-1 -lgomp -lm -std=c99 -mfpmath=sse -msse3 -I/usr/include/glib-2.0 "
"-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lglib-2.0 -lpcre -o {bfile}"
.replace("$O", optimisation),
"run_cmd": "./{bfile} {input} > /dev/null"
}, {
"name": "clang",
"build_cmd": "cp {file} {bfile}.c; clang-$CV {bfile}.c $O -I/usr/include/tcl8.6 -ltcl8.4 -fopenmp=libgomp "
"-lglib-2.0 -lgmp -D_GNU_SOURCE -Doff_t=__off64_t -D_FILE_OFFSET_BITS=64 "
"-I/usr/include/apr-1.0 -lapr-1 -lm -std=c99 -mfpmath=sse -msse3 -I/usr/include/glib-2.0 "
"-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lglib-2.0 -lpcre -o {bfile}"
.replace("$CV", clang_version).replace("$O", optimisation),
"run_cmd": "./{bfile} {input} > /dev/null"
}
]
}
return config
评论列表
文章目录