diff --git a/.gitignore b/.gitignore index c37ddf5..ba51019 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ bin/.coursier bin/.scalafmt* results/ *.iprof -.idea \ No newline at end of file +.idea +build.sbt +project/plugins.sbt \ No newline at end of file diff --git a/build.sbt b/build.sbt index ae87f31..441c07f 100644 --- a/build.sbt +++ b/build.sbt @@ -1,3 +1,4 @@ +name := "scala-native-benchmarks" scalaVersion := "2.11.12" enablePlugins(ScalaNativePlugin) nativeLinkStubs := true diff --git a/confs/baseline/build.sbt b/confs/baseline/build.sbt index ae87f31..441c07f 100644 --- a/confs/baseline/build.sbt +++ b/confs/baseline/build.sbt @@ -1,3 +1,4 @@ +name := "scala-native-benchmarks" scalaVersion := "2.11.12" enablePlugins(ScalaNativePlugin) nativeLinkStubs := true diff --git a/confs/current/build.sbt b/confs/current/build.sbt index ae87f31..441c07f 100644 --- a/confs/current/build.sbt +++ b/confs/current/build.sbt @@ -1,3 +1,4 @@ +name := "scala-native-benchmarks" scalaVersion := "2.11.12" enablePlugins(ScalaNativePlugin) nativeLinkStubs := true diff --git a/confs/jvm/build.sbt b/confs/jvm/build.sbt index 9874e27..ef3680d 100644 --- a/confs/jvm/build.sbt +++ b/confs/jvm/build.sbt @@ -1 +1,2 @@ +name := "scala-native-benchmarks" scalaVersion := "2.11.12" diff --git a/confs/native-image-pgo/build.sbt b/confs/native-image-pgo/build.sbt index 65e12d6..c622b0a 100644 --- a/confs/native-image-pgo/build.sbt +++ b/confs/native-image-pgo/build.sbt @@ -1,3 +1,4 @@ +name := "scala-native-benchmarks" scalaVersion := "2.11.12" val instrumentedRuns = settingKey[Int]("The number of instrumented runs.") diff --git a/confs/native-image/build.sbt b/confs/native-image/build.sbt index 065cf09..4073552 100644 --- a/confs/native-image/build.sbt +++ b/confs/native-image/build.sbt @@ -1,3 +1,4 @@ +name := "scala-native-benchmarks" scalaVersion := "2.11.12" val nativeImage = taskKey[Unit]("Builds a native image of a benchmark.") diff --git a/confs/scala-native-0.3.7/build.sbt b/confs/scala-native-0.3.7/build.sbt index b4a5690..702aa9d 100644 --- a/confs/scala-native-0.3.7/build.sbt +++ b/confs/scala-native-0.3.7/build.sbt @@ -1,3 +1,4 @@ +name := "scala-native-benchmarks" scalaVersion := "2.11.12" enablePlugins(ScalaNativePlugin) nativeLinkStubs := true diff --git a/confs/scala-native-0.3.7/run b/confs/scala-native-0.3.7/run index 0ea88ec..ae89e34 100644 --- a/confs/scala-native-0.3.7/run +++ b/confs/scala-native-0.3.7/run @@ -1 +1 @@ -target/scala-2.11/benchs-out +target/scala-2.11/scala-native-benchmarks-out diff --git a/confs/scala-native-0.3.8/build.sbt b/confs/scala-native-0.3.8/build.sbt index b4a5690..702aa9d 100644 --- a/confs/scala-native-0.3.8/build.sbt +++ b/confs/scala-native-0.3.8/build.sbt @@ -1,3 +1,4 @@ +name := "scala-native-benchmarks" scalaVersion := "2.11.12" enablePlugins(ScalaNativePlugin) nativeLinkStubs := true diff --git a/confs/scala-native-0.3.8/run b/confs/scala-native-0.3.8/run index 0ea88ec..ae89e34 100644 --- a/confs/scala-native-0.3.8/run +++ b/confs/scala-native-0.3.8/run @@ -1 +1 @@ -target/scala-2.11/benchs-out +target/scala-2.11/scala-native-benchmarks-out diff --git a/confs/scala-native-0.3.9-SNAPSHOT-commix/build.sbt b/confs/scala-native-0.3.9-SNAPSHOT-commix/build.sbt new file mode 100644 index 0000000..2104b7a --- /dev/null +++ b/confs/scala-native-0.3.9-SNAPSHOT-commix/build.sbt @@ -0,0 +1,6 @@ +scalaVersion := "2.11.12" +enablePlugins(ScalaNativePlugin) +nativeLinkStubs := true +nativeGC := "commix" +nativeMode := "release" +nativeLTO := "thin" diff --git a/confs/scala-native-0.3.9-SNAPSHOT-commix/compile b/confs/scala-native-0.3.9-SNAPSHOT-commix/compile new file mode 100644 index 0000000..2f3f09f --- /dev/null +++ b/confs/scala-native-0.3.9-SNAPSHOT-commix/compile @@ -0,0 +1 @@ +nativeLink diff --git a/confs/scala-native-0.3.9-SNAPSHOT-commix/plugins.sbt b/confs/scala-native-0.3.9-SNAPSHOT-commix/plugins.sbt new file mode 100644 index 0000000..c1423b6 --- /dev/null +++ b/confs/scala-native-0.3.9-SNAPSHOT-commix/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.9-SNAPSHOT") diff --git a/confs/scala-native-0.3.9-SNAPSHOT-commix/run b/confs/scala-native-0.3.9-SNAPSHOT-commix/run new file mode 100644 index 0000000..ae89e34 --- /dev/null +++ b/confs/scala-native-0.3.9-SNAPSHOT-commix/run @@ -0,0 +1 @@ +target/scala-2.11/scala-native-benchmarks-out diff --git a/confs/scala-native-0.3.9-SNAPSHOT-full-lto/build.sbt b/confs/scala-native-0.3.9-SNAPSHOT-full-lto/build.sbt new file mode 100644 index 0000000..fae449a --- /dev/null +++ b/confs/scala-native-0.3.9-SNAPSHOT-full-lto/build.sbt @@ -0,0 +1,6 @@ +scalaVersion := "2.11.12" +enablePlugins(ScalaNativePlugin) +nativeLinkStubs := true +nativeGC := "immix" +nativeMode := "release" +nativeLTO := "full" diff --git a/confs/scala-native-0.3.9-SNAPSHOT-full-lto/compile b/confs/scala-native-0.3.9-SNAPSHOT-full-lto/compile new file mode 100644 index 0000000..2f3f09f --- /dev/null +++ b/confs/scala-native-0.3.9-SNAPSHOT-full-lto/compile @@ -0,0 +1 @@ +nativeLink diff --git a/confs/scala-native-0.3.9-SNAPSHOT-full-lto/plugins.sbt b/confs/scala-native-0.3.9-SNAPSHOT-full-lto/plugins.sbt new file mode 100644 index 0000000..c1423b6 --- /dev/null +++ b/confs/scala-native-0.3.9-SNAPSHOT-full-lto/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.9-SNAPSHOT") diff --git a/confs/scala-native-0.3.9-SNAPSHOT-full-lto/run b/confs/scala-native-0.3.9-SNAPSHOT-full-lto/run new file mode 100644 index 0000000..ae89e34 --- /dev/null +++ b/confs/scala-native-0.3.9-SNAPSHOT-full-lto/run @@ -0,0 +1 @@ +target/scala-2.11/scala-native-benchmarks-out diff --git a/confs/scala-native-0.3.9-SNAPSHOT-no-lto/build.sbt b/confs/scala-native-0.3.9-SNAPSHOT-no-lto/build.sbt new file mode 100644 index 0000000..2fc1873 --- /dev/null +++ b/confs/scala-native-0.3.9-SNAPSHOT-no-lto/build.sbt @@ -0,0 +1,6 @@ +scalaVersion := "2.11.12" +enablePlugins(ScalaNativePlugin) +nativeLinkStubs := true +nativeGC := "immix" +nativeMode := "release" +nativeLTO := "none" diff --git a/confs/scala-native-0.3.9-SNAPSHOT-no-lto/compile b/confs/scala-native-0.3.9-SNAPSHOT-no-lto/compile new file mode 100644 index 0000000..2f3f09f --- /dev/null +++ b/confs/scala-native-0.3.9-SNAPSHOT-no-lto/compile @@ -0,0 +1 @@ +nativeLink diff --git a/confs/scala-native-0.3.9-SNAPSHOT-no-lto/plugins.sbt b/confs/scala-native-0.3.9-SNAPSHOT-no-lto/plugins.sbt new file mode 100644 index 0000000..c1423b6 --- /dev/null +++ b/confs/scala-native-0.3.9-SNAPSHOT-no-lto/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.9-SNAPSHOT") diff --git a/confs/scala-native-0.3.9-SNAPSHOT-no-lto/run b/confs/scala-native-0.3.9-SNAPSHOT-no-lto/run new file mode 100644 index 0000000..ae89e34 --- /dev/null +++ b/confs/scala-native-0.3.9-SNAPSHOT-no-lto/run @@ -0,0 +1 @@ +target/scala-2.11/scala-native-benchmarks-out diff --git a/confs/scala-native-0.3.9-SNAPSHOT/build.sbt b/confs/scala-native-0.3.9-SNAPSHOT/build.sbt new file mode 100644 index 0000000..ae87f31 --- /dev/null +++ b/confs/scala-native-0.3.9-SNAPSHOT/build.sbt @@ -0,0 +1,6 @@ +scalaVersion := "2.11.12" +enablePlugins(ScalaNativePlugin) +nativeLinkStubs := true +nativeGC := "immix" +nativeMode := "release" +nativeLTO := "thin" diff --git a/confs/scala-native-0.3.9-SNAPSHOT/compile b/confs/scala-native-0.3.9-SNAPSHOT/compile new file mode 100644 index 0000000..2f3f09f --- /dev/null +++ b/confs/scala-native-0.3.9-SNAPSHOT/compile @@ -0,0 +1 @@ +nativeLink diff --git a/confs/scala-native-0.3.9-SNAPSHOT/plugins.sbt b/confs/scala-native-0.3.9-SNAPSHOT/plugins.sbt new file mode 100644 index 0000000..c1423b6 --- /dev/null +++ b/confs/scala-native-0.3.9-SNAPSHOT/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.9-SNAPSHOT") diff --git a/confs/scala-native-0.3.9-SNAPSHOT/run b/confs/scala-native-0.3.9-SNAPSHOT/run new file mode 100644 index 0000000..ae89e34 --- /dev/null +++ b/confs/scala-native-0.3.9-SNAPSHOT/run @@ -0,0 +1 @@ +target/scala-2.11/scala-native-benchmarks-out diff --git a/confs/scala-native-0.3.9/build.sbt b/confs/scala-native-0.3.9/build.sbt new file mode 100644 index 0000000..702aa9d --- /dev/null +++ b/confs/scala-native-0.3.9/build.sbt @@ -0,0 +1,6 @@ +name := "scala-native-benchmarks" +scalaVersion := "2.11.12" +enablePlugins(ScalaNativePlugin) +nativeLinkStubs := true +nativeGC := "immix" +nativeMode := "release" diff --git a/confs/scala-native-0.3.9/compile b/confs/scala-native-0.3.9/compile new file mode 100644 index 0000000..2f3f09f --- /dev/null +++ b/confs/scala-native-0.3.9/compile @@ -0,0 +1 @@ +nativeLink diff --git a/confs/scala-native-0.3.9/plugins.sbt b/confs/scala-native-0.3.9/plugins.sbt new file mode 100644 index 0000000..81f6e69 --- /dev/null +++ b/confs/scala-native-0.3.9/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.9") diff --git a/confs/scala-native-0.3.9/run b/confs/scala-native-0.3.9/run new file mode 100644 index 0000000..ae89e34 --- /dev/null +++ b/confs/scala-native-0.3.9/run @@ -0,0 +1 @@ +target/scala-2.11/scala-native-benchmarks-out diff --git a/confs/scala-native-0.4.0-SNAPSHOT-commix/build.sbt b/confs/scala-native-0.4.0-SNAPSHOT-commix/build.sbt new file mode 100644 index 0000000..2104b7a --- /dev/null +++ b/confs/scala-native-0.4.0-SNAPSHOT-commix/build.sbt @@ -0,0 +1,6 @@ +scalaVersion := "2.11.12" +enablePlugins(ScalaNativePlugin) +nativeLinkStubs := true +nativeGC := "commix" +nativeMode := "release" +nativeLTO := "thin" diff --git a/confs/scala-native-0.4.0-SNAPSHOT-commix/compile b/confs/scala-native-0.4.0-SNAPSHOT-commix/compile new file mode 100644 index 0000000..2f3f09f --- /dev/null +++ b/confs/scala-native-0.4.0-SNAPSHOT-commix/compile @@ -0,0 +1 @@ +nativeLink diff --git a/confs/scala-native-0.4.0-SNAPSHOT-commix/plugins.sbt b/confs/scala-native-0.4.0-SNAPSHOT-commix/plugins.sbt new file mode 100644 index 0000000..2a63bf0 --- /dev/null +++ b/confs/scala-native-0.4.0-SNAPSHOT-commix/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0-SNAPSHOT") diff --git a/confs/scala-native-0.4.0-SNAPSHOT-commix/run b/confs/scala-native-0.4.0-SNAPSHOT-commix/run new file mode 100644 index 0000000..ae89e34 --- /dev/null +++ b/confs/scala-native-0.4.0-SNAPSHOT-commix/run @@ -0,0 +1 @@ +target/scala-2.11/scala-native-benchmarks-out diff --git a/confs/scala-native-0.4.0-SNAPSHOT/build.sbt b/confs/scala-native-0.4.0-SNAPSHOT/build.sbt new file mode 100644 index 0000000..ae87f31 --- /dev/null +++ b/confs/scala-native-0.4.0-SNAPSHOT/build.sbt @@ -0,0 +1,6 @@ +scalaVersion := "2.11.12" +enablePlugins(ScalaNativePlugin) +nativeLinkStubs := true +nativeGC := "immix" +nativeMode := "release" +nativeLTO := "thin" diff --git a/confs/scala-native-0.4.0-SNAPSHOT/compile b/confs/scala-native-0.4.0-SNAPSHOT/compile new file mode 100644 index 0000000..2f3f09f --- /dev/null +++ b/confs/scala-native-0.4.0-SNAPSHOT/compile @@ -0,0 +1 @@ +nativeLink diff --git a/confs/scala-native-0.4.0-SNAPSHOT/plugins.sbt b/confs/scala-native-0.4.0-SNAPSHOT/plugins.sbt new file mode 100644 index 0000000..2a63bf0 --- /dev/null +++ b/confs/scala-native-0.4.0-SNAPSHOT/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0-SNAPSHOT") diff --git a/confs/scala-native-0.4.0-SNAPSHOT/run b/confs/scala-native-0.4.0-SNAPSHOT/run new file mode 100644 index 0000000..ae89e34 --- /dev/null +++ b/confs/scala-native-0.4.0-SNAPSHOT/run @@ -0,0 +1 @@ +target/scala-2.11/scala-native-benchmarks-out diff --git a/project/build.sbt b/project/build.sbt deleted file mode 100644 index 8b13789..0000000 --- a/project/build.sbt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/scripts/run.py b/scripts/run.py index 7a02658..1cbec53 100755 --- a/scripts/run.py +++ b/scripts/run.py @@ -1,9 +1,10 @@ #!/usr/bin/env python -import sys import os import errno import subprocess as subp import shutil as sh +import argparse + def mkdir(path): try: @@ -14,10 +15,12 @@ def mkdir(path): else: raise + def slurp(path): with open(path) as f: return f.read().strip() + def where(cmd): if os.path.isfile(cmd): return cmd @@ -30,16 +33,19 @@ def where(cmd): else: return None + def run(cmd): print(">>> " + str(cmd)) return subp.check_output(cmd) + def compile(bench, compilecmd): cmd = [sbt, '-J-Xmx6G', 'clean'] cmd.append('set mainClass in Compile := Some("{}")'.format(bench)) cmd.append(compilecmd) return run(cmd) + sbt = where('sbt') benchmarks = [ @@ -61,15 +67,15 @@ def compile(bench, compilecmd): 'mandelbrot.MandelbrotBenchmark', ] -configurations = [ - # 'jvm', - # 'scala-native-0.3.8', - # 'baseline', - 'current' -] +stable = 'scala-native-0.3.9' +latest = 'scala-native-0.4.0-SNAPSHOT' + +confs_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + "/confs" + +all_configs = next(os.walk(confs_path))[1] if 'GRAALVM_HOME' in os.environ: - configurations += [ + all_configs += [ 'native-image', 'native-image-pgo', ] @@ -78,7 +84,34 @@ def compile(bench, compilecmd): batches = 4000 batch_size = 1 + +def expand_wild_cards(arg): + if arg == None: + return arg + elif arg.startswith("latest"): + return latest + arg[len("latest"):] + elif arg.startswith("stable"): + return stable + arg[len("stable"):] + else: + return arg + + if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("set", nargs='*', default=[None]) + args = parser.parse_args() + print args + + configurations = [] + for choice in args.set: + expanded = expand_wild_cards(choice) + if expanded == None: + configurations = [stable, latest] + else: + configurations += [expanded] + + print "configurations:", configurations + for conf in configurations: for bench in benchmarks: print('--- conf: {}, bench: {}'.format(conf, bench))