GitLab will be upgraded to the 12.10.14-ce.0 on 28 Sept 2020 at 2.00pm (AEDT) to 2.30pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

Commit bb5dc64c authored by Zixian Cai's avatar Zixian Cai

Merge branch 'master' of gitlab.anu.edu.au:mu/mu-perf-benchmarks

parents 06922a71 8a24df1e
# Copyright 2017 The Australian National University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
alloc:
iterations: 10
benchmark:
name: micro/alloc
args:
- 10 # scale factor
- 1000000
callback:
name: clock
environ:
PYPY_USESSION_DIR: ci
tasks:
rpyc_no_gc:
language:
name: rpython
backend: c
source: targetalloc.py
compiler:
flags:
- --gc=none
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
rpyzebu:
language:
name: rpython
backend: mu
impl: zebu
source: targetalloc.py
compiler:
pypydir: $PYPY_MU
vmargs:
- --gc-immixspace-size=524288000 # 500M
- --gc-lospace-size=104587600 # 100M
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
# Copyright 2017 The Australian National University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
btree:
benchmark:
name: game/binarytrees
args:
- 15 # depth
iterations: 10
callback: clock
environ:
PYPY_USESSION_DIR: ci
tasks:
rpyc_no_gc:
language:
name: rpython
backend: c
source: targetbtree.py
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compiler:
flags:
- --gc=none
rpyzebu:
language:
name: rpython
backend: mu
impl: zebu
source: targetbtree.py
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compiler:
vmargs:
- --gc-immixspace-size=524288000 # 500M
- --gc-lospace-size=104587600 # 100M
compare:
- - rpyc_no_gc
- rpyzebu
# Copyright 2017 The Australian National University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# The first custom (in this case 2000) is the recursion depth
# the second argument means:
# 0 don't throw an exception, but still have a catch block at the top
# 1 do throw an exception at the bottom of the recursion (to be caught by the top)
# 2 don't throw an exception, with no catch block
# the third argument is the scale factor
except:
benchmark:
name: micro/except
args:
- 2000
- 1
- 10
iterations: 10
callback:
name: clock
environ:
PYPY_USESSION_DIR: ci
tasks:
rpyc_no_gc:
language:
name: rpython
backend: c
source: targetexcept.py
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compiler:
flags:
- --gc=none
rpyzebu:
language:
name: rpython
backend: mu
impl: zebu
source: targetexcept.py
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compiler:
pypydir: $PYPY_MU
vmargs:
- --gc-immixspace-size=524288000 # 500M
- --gc-lospace-size=104587600 # 100M
# Copyright 2017 The Australian National University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
fannkuchredux:
benchmark:
name: game/fannkuchredux
args:
- 10
iterations: 10
callback: clock
environ:
PYPY_USESSION_DIR: ci
tasks:
rpyc_no_gc:
language:
name: rpython
backend: c
source: targetfannkuchredux.py
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compiler:
flags:
- --gc=none
rpyzebu:
language:
name: rpython
backend: mu
impl: zebu
source: targetfannkuchredux.py
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compiler:
vmargs:
- --gc-immixspace-size=524288000 # 500M
- --gc-lospace-size=104587600 # 100M
compare:
- - rpyc_no_gc
- rpyzebu
\ No newline at end of file
# Copyright 2017 The Australian National University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
fib:
iterations: 10
benchmark:
name: micro/fib
args:
- 10 # scale factor
- 35
callback:
name: clock
environ:
PYPY_USESSION_DIR: ci # controls where PyPy puts usession directory
tasks:
rpyc_no_gc:
language:
name: rpython
backend: c
source: targetfib.py
compiler:
flags:
- --gc=none
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
rpyzebu:
language:
name: rpython
backend: mu
impl: zebu
source: targetfib.py
compiler:
pypydir: $PYPY_MU
vmargs:
- --gc-immixspace-size=524288000 # 500M
- --gc-lospace-size=104587600 # 100M
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compare:
- - rpyc_O3
- rpyzebu
# Copyright 2017 The Australian National University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
nbody:
benchmark:
name: game/nbody
args:
- 50000000
iterations: 10
callback: clock
environ:
PYPY_USESSION_DIR: ci
tasks:
rpyc_no_gc:
language:
name: rpython
backend: c
source: targetnbody.py
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compiler:
flags:
- --gc=none
rpyzebu:
language:
name: rpython
backend: mu
impl: zebu
source: targetnbody.py
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compiler:
vmargs:
- --gc-immixspace-size=524288000 # 500M
- --gc-lospace-size=104587600 # 100M
# Copyright 2017 The Australian National University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
pidigits:
benchmark:
name: game/pidigits
args:
- 10000 # depth
iterations: 10
callback: clock
environ:
PYPY_USESSION_DIR: ci
tasks:
rpyc_no_gc:
language:
name: rpython
backend: c
source: targetpidigits.py
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compiler:
flags:
- --gc=none
rpyzebu:
language:
name: rpython
backend: mu
impl: zebu
source: targetpidigits.py
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compiler:
vmargs:
- --gc-immixspace-size=524288000 # 500M
- --gc-lospace-size=104587600 # 100M
# Copyright 2017 The Australian National University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE: the scale factor of this test is specified at compile time
quicksort:
benchmark:
name: micro/quicksort
iterations: 10
callback:
name: clock
environ:
PYPY_USESSION_DIR: ci
tasks:
rpyc_no_gc:
language:
name: rpython
backend: c
source: targetquicksort.py
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compiler:
flags:
- --gc=none
args:
- &scale_factor 1000
rpyzebu:
language:
name: rpython
backend: mu
impl: zebu
source: targetquicksort.py
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compiler:
args:
- *scale_factor
# Copyright 2017 The Australian National University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
som:
iterations: 10
benchmark:
name: SOM
args:
- 5 # scale factor
- -cp
- $RPYSOM/Smalltalk
- $RPYSOM/TestSuite/TestHarness.som
callback: clock
environ:
PYPY_USESSION_DIR: ci
PYTHONPATH: $RPYSOM/src
tasks:
rpyc_no_gc:
language:
name: rpython
backend: c
source: targetrpysom.py
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
flags:
- --gc=none
rpyzebu:
language:
name: rpython
backend: mu
impl: zebu
source: targetrpysom.py
environ:
ZEBU_BUILD: "release"
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compiler:
vmargs:
- --gc-immixspace-size=1024288000
- --gc-lospace-size=204587600
# Copyright 2017 The Australian National University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
spectralnorm:
benchmark:
name: game/spectralnorm
args:
- 5500 # depth
iterations: 10
callback: clock
environ:
PYPY_USESSION_DIR: ci
tasks:
rpyc_no_gc:
language:
name: rpython
backend: c
source: targetspectralnorm.py
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compiler:
flags:
- --gc=none
rpyzebu:
language:
name: rpython
backend: mu
impl: zebu
source: targetspectralnorm.py
environ:
PYPY_USESSION_BASENAME: "${MUBENCH_TASKSET_NAME}_${MUBENCH_TASK_NAME}"
compiler:
vmargs:
- --gc-immixspace-size=524288000 # 500M
- --gc-lospace-size=104587600 # 100M
#!/usr/bin/env python3
import glob
import os
import sys
from os import path
from subprocess import call
# create log directory
LOG_DIR = path.join(os.getcwd(), "mubench_log")
print("Log will be put under %s" % LOG_DIR)
try:
os.stat(LOG_DIR)
except:
print("creating mubench_log directory...")
os.mkdir(LOG_DIR)
def run_bm(bm):
config_file = path.basename(bm)
bm_name = path.splitext(config_file)[0]
# log file (all the outputs from the execution)
log_file = bm_name + ".log"
log_file_path = path.join(LOG_DIR, log_file)
f = open(log_file_path, "w")
# result file (actual result)
result_file = bm_name + ".result"
result_file_path = path.join(LOG_DIR, result_file)
print("Running mubench: %s" % bm_name)
print("(output to: %s)" % log_file)
cmd = [
"python3",
"mubench",
"local", bm,
"--pipeline", "",
"--dump", result_file_path
]
print(cmd)
ret = call(cmd, stdout=f, stderr=f)
if ret != 0:
print("failed to execute %s: return code: %d" % (bm_name, ret))
print()
LINE = "-------------------------------------"
print(LINE)
# get all config files
config_pattern = path.join(path.dirname(path.abspath(__file__)), "*.yml")
print("searching for all config files: " + config_pattern)
bm_configs = glob.glob(config_pattern)
bms = []
for bm_path in bm_configs:
config_file = path.basename(bm_path)
bm_name = path.splitext(config_file)[0]
if bm_name.startswith("bm_"):
bms.append(bm_name[3:])
elif bm_name.startswith("test_"):
bms.append(bm_name[5:])
print("all the benchmarks: %s" % bms)
# what bms we are going to run
# (if user told us specific bms to run, we run them onlythose specific bms; otherwise we run everything)
specific_bm_to_run = []
if len(sys.argv) > 1:
specific_bm_to_run = sys.argv[1:]
else:
specific_bm_to_run = bms
print("benchmarks to run: %s" % specific_bm_to_run)
print(LINE)
for i in range(0, len(bms)):
bm_path = bm_configs[i]
bm_name = bms[i]
if bm_name in specific_bm_to_run:
run_bm(bm_path)
print(LINE)
\ No newline at end of file
import sys
from math import sqrt
def combinations(l):
result = []
for x in range(len(l) - 1):
ls = l[x+1:]
for y in ls:
result.append(BodyPair(l[x], y))
return result
PI = 3.14159265358979323
SOLAR_MASS = 4 * PI * PI
DAYS_PER_YEAR = 365.24
class Body:
def __init__(self, x, y, z, vx, vy, vz, mass):
self.x = x
self.y = y
self.z = z
self.vx = vx
self.vy = vy
self.vz = vz
self.mass = mass
class BodyPair:
def __init__(self, body1, body2):
self.body1 = body1
self.body2 = body2
BODIES = {
'sun': Body(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SOLAR_MASS),
'jupiter': Body(4.84143144246472090e+00,
-1.16032004402742839e+00,
-1.03622044471123109e-01,
1.66007664274403694e-03 * DAYS_PER_YEAR,
7.69901118419740425e-03 * DAYS_PER_YEAR,
-6.90460016972063023e-05 * DAYS_PER_YEAR,
9.54791938424326609e-04 * SOLAR_MASS),
'saturn': Body(8.34336671824457987e+00,
4.12479856412430479e+00,
-4.03523417114321381e-01,
-2.76742510726862411e-03 * DAYS_PER_YEAR,
4.99852801234917238e-03 * DAYS_PER_YEAR,
2.30417297573763929e-05 * DAYS_PER_YEAR,
2.85885980666130812e-04 * SOLAR_MASS),
'uranus': Body(1.28943695621391310e+01,
-1.51111514016986312e+01,
-2.23307578892655734e-01,
2.96460137564761618e-03 * DAYS_PER_YEAR,
2.37847173959480950e-03 * DAYS_PER_YEAR,
-2.96589568540237556e-05 * DAYS_PER_YEAR,
4.36624404335156298e-05 * SOLAR_MASS),
'neptune': Body(1.53796971148509165e+01,
-2.59193146099879641e+01,
1.79258772950371181e-01,
2.68067772490389322e-03 * DAYS_PER_YEAR,
1.62824170038242295e-03 * DAYS_PER_YEAR,
-9.51592254519715870e-05 * DAYS_PER_YEAR,
5.15138902046611451e-05 * SOLAR_MASS)
}
SYSTEM = [BODIES['sun'], BODIES['jupiter'], BODIES['saturn'], BODIES['uranus'], BODIES['neptune']]
PAIRS = combinations(SYSTEM)
def advance(dt, n, bodies=SYSTEM, pairs=PAIRS):
for i in range(n):
for body_pair in pairs:
body1 = body_pair.body1
body2 = body_pair.body2
x1 = body1.x
y1 = body1.y
z1 = body1.z
m1 = body1.mass
x2 = body2.x
y2 = body2.y
z2 = body2.z
m2 = body2.mass
dx = x1 - x2
dy = y1 - y2
dz = z1 - z2
dist = sqrt(dx * dx + dy * dy + dz * dz);
mag = dt / (dist*dist*dist)
b1m = m1 * mag
b2m = m2 * mag
body1.vx -= dx * b2m
body1.vy -= dy * b2m
body1.vz -= dz * b2m
body2.vz += dz * b1m
body2.vy += dy * b1m
body2.vx += dx * b1m
for body in bodies:
body.x += dt * body.vx
body.y += dt * body.vy
body.z += dt * body.vz
def report_energy(bodies=SYSTEM, pairs=PAIRS, e=0.0):
for body_pair in pairs:
body1 = body_pair.body1
body2 = body_pair.body2
x1 = body1.x
y1 = body1.y
z1 = body1.z
m1 = body1.mass
x2 = body2.x
y2 = body2.y
z2 = body2.z
m2 = body2.mass
dx = x1 - x2
dy = y1 - y2
dz = z1 - z2
e -= (m1 * m2) / (sqrt(dx * dx + dy * dy + dz * dz))
for body in bodies:
vx = body.vx
vy = body.vy
vz = body.vz
m = body.mass
e += m * (vx * vx + vy * vy + vz * vz) / 2.
print("%f" % e)
def offset_momentum(ref, bodies=SYSTEM, px=0.0, py=0.0, pz=0.0):
for body in bodies:
vx = body.vx
vy = body.vy
vz = body.vz
m = body.mass
px -= vx * m
py -= vy * m
pz -= vz * m
ref.vx = px / ref.mass
ref.vy = py / ref.mass
ref.vz = pz / ref.mass
def bm_main(n, ref='sun'):
offset_momentum(BODIES[ref])
report_energy()
advance(0.01, n)
report_energy()
def target(driver, args):
from callback import get_callback
cb_cls = get_callback(args[0])
def main(argv):
cb_param = argv[1]
N = int(argv[2])
cb = cb_cls(cb_param)