Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions benchpress/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,25 @@ silo:
- latency:
- avg_latency

minebench_kmeans:
parser: minebench_kmeans
path: ./benchmarks/minebench/time_wrap.sh
metrics:
- execution_time:
- real
- user
- sys

minebench_plsa:
parser: minebench_plsa
path: ./benchmarks/minebench/plsa
metrics:
- execution_time:
- total_time

minebench_rsearch:
parser: minebench_rsearch
path: ./benchmarks/minebench/rsearch/bin/rsearch
metrics:
- execution_time:
- total_time
7 changes: 6 additions & 1 deletion benchpress/benchpress/lib/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ def run(self):

try:
logger.info('Starting "{}"'.format(self.name))
cmd = [self.binary] + self.args
safe_args = []
for arg in self.args:
for sub_arg in arg.split(' '):
safe_args.append(sub_arg)

cmd = [self.binary] + safe_args
process = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
Expand Down
6 changes: 6 additions & 0 deletions benchpress/benchpress/plugins/parsers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
from .fio import FioParser
from .generic import JSONParser
from .ltp import LtpParser
from .minebench import KMeansParser
from .minebench import PLSAParser
from .minebench import RSearchParser
from .returncode import ReturncodeParser
from .schbench import SchbenchParser
from .silo import SiloParser
Expand All @@ -18,6 +21,9 @@ def register_parsers(factory):
factory.register('fio', FioParser)
factory.register('json', JSONParser)
factory.register('ltp', LtpParser)
factory.register('minebench_kmeans', KMeansParser)
factory.register('minebench_plsa', PLSAParser)
factory.register('minebench_rsearch', RSearchParser)
factory.register('returncode', ReturncodeParser)
factory.register('schbench', SchbenchParser)
factory.register('silo', SiloParser)
73 changes: 73 additions & 0 deletions benchpress/benchpress/plugins/parsers/minebench.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.

import re

from benchpress.lib.parser import Parser


def _minebench_regex_parser(regex, output):
m = re.search(regex, output)
return m.groupdict() if m else {}


def _field_map(d, keys, f):
return {k: f(d[k]) for k in keys if k in d}


class KMeansParser(Parser):
"""Example output:
real 2.00
user 1.50
sys 0.02
"""

TIME_REGEX = (
r'^real\s(?P<real>\d+\.\d+)'
r'user\s(?P<user>\d+\.\d+)'
r'sys\s(?P<sys>\d+\.\d+)'
)

def parse(self, stdout, stderr, returncode):
output = ''.join(stderr)
times = _minebench_regex_parser(KMeansParser.TIME_REGEX, output)
times = _field_map(times, ['real', 'user', 'sys'], float)
return {'execution_time': times}


class PLSAParser(Parser):
"""Example output:
Forward time: 26.47s
BackwardFindPathsForHugeBlock Time: 7.60
Second phase in backward period Time: 6.19

Success!
Total time: 40.26s
"""

PLSA_REGEX = r'Total\stime:\s(?P<total_time>\d+\.\d+)s'

def parse(self, stdout, stderr, returncode):
output = ''.join(stdout)
times = _minebench_regex_parser(PLSAParser.PLSA_REGEX, output)
times = _field_map(times, ['total_time'], float)
return {'execution_time': times}


class RSearchParser(Parser):
"""Example output:
we cost 199.2 seconds totally, 22.0 for making histogram
Fin
"""

RSEARCH_REGEX = r'we\scost\s(?P<total_time>\d+\.\d+)\sseconds'

def parse(self, stdout, stderr, returncode):
output = ''.join(stdout)
times = _minebench_regex_parser(RSearchParser.RSEARCH_REGEX, output)
times = _field_map(times, ['total_time'], float)
return {'execution_time': times}
68 changes: 68 additions & 0 deletions benchpress/install_minebench.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash
set -e
set -x

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a section for prerequisites and add the libraries we assume are going to be installed.

Maybe use our test host as baseline and then add any additional libraries that were installed before we can run this benchmark

NU_MINEBENCH_VERSION='NU-MineBench-3.0.1'
NU_MINEBENCH_TAR_FILE="${NU_MINEBENCH_VERSION}.tar.gz"
NU_MINEBENCH_DOWNLOAD_URL="http://cucis.ece.northwestern.edu/projects/DMS"

KMEANS_DATASET_TAR_FILE="kmeans.tar.gz"
PLSA_DATASET_TAR_FILE="PLSA.tar.gz"
RSEARCH_DATASET_TAR_FILE="rsearch.tar.gz"
NU_MINEBENCH_DATASETS="${KMEANS_DATASET_TAR_FILE} ${PLSA_DATASET_TAR_FILE} ${RSEARCH_DATASET_TAR_FILE}"

BENCHMARKS_DIR="$(pwd)/benchmarks"
mkdir -p "${BENCHMARKS_DIR}"
mkdir -p "${BENCHMARKS_DIR}/minebench"
mkdir -p "${BENCHMARKS_DIR}/minebench/datasets"



echo 'Downloading NU-MineBench and its datasets'
cd "${BENCHMARKS_DIR}/minebench/datasets/"
for dataset in $NU_MINEBENCH_DATASETS; do
wget "${NU_MINEBENCH_DOWNLOAD_URL}/DATASETS/$dataset"
tar -zxvf $dataset
done
cd "${BENCHMARKS_DIR}/.."

cp templates/time_wrap.sh "${BENCHMARKS_DIR}/minebench/"
chmod u+x "${BENCHMARKS_DIR}/minebench/time_wrap.sh"

rm -rf build
mkdir -p build
cd build

wget "${NU_MINEBENCH_DOWNLOAD_URL}/${NU_MINEBENCH_TAR_FILE}"
tar -xzvf "${NU_MINEBENCH_TAR_FILE}"
cd "$NU_MINEBENCH_VERSION"



echo 'Compiling and Installing KMeans'
cd 'KMeans/'
make OPTFLAGS="-O3" example
cp 'example' "${BENCHMARKS_DIR}/minebench/kmeans"
cd ../
echo 'Done installing KMeans'

echo 'Compiling and Installing PLSA'
cd 'PLSA/'
make COMPILEOPTION='-g -Wno-write-strings -fopenmp -O3' -f Makefile.omp
cp 'parasw.mt' "${BENCHMARKS_DIR}/minebench/plsa"
cd ../
echo 'Done installing PLSA'

echo 'Compiling and Installing RSearch'
cd 'RSEARCH/'
./configure --prefix="${BENCHMARKS_DIR}/minebench/rsearch"
make CFLAGS="-O3 -fopenmp"
make install
cd ../
echo 'Done installing RSearch'

cd ../../

rm -rf build/

echo "NU-MineBench installed into ${BENCHMARKS_DIR}/minebench"
39 changes: 38 additions & 1 deletion benchpress/jobs/jobs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- benchmark: schbench
name: schbench default
name: schbench default
description: defaults for schbench
args:
message-threads: 2
Expand Down Expand Up @@ -72,3 +72,40 @@
scale-factor: 1
runtime: 1

- benchmark: minebench_kmeans
name: minebench_kmeans default
description: defaults for minebench_kmeans
args:
- 'benchmarks/minebench/kmeans'
- '-b' # binary input
- '-o' # output time
- '-p 32' # threads to use
- '-m 50' # max number of clusters
- '-n 4' # min number of clusters
- '-f' # fuzzy kmeans
- '-i benchmarks/minebench/datasets/kmeans/edge' # dataset to cluster

- benchmark: minebench_plsa
name: minebench_plsa default
description: defaults for minebench_plsa
args:
- 'benchmarks/minebench/datasets/PLSA/30k_1.txt'
- 'benchmarks/minebench/datasets/PLSA/30k_2.txt'
- 'benchmarks/minebench/datasets/PLSA/pam120.bla'
- '600'
- '400'
- '3'
- '3'
- '1'
- '32'

- benchmark: minebench_rsearch
name: minebench_rsearch default
description: defaults for minebench_rsearch
args:
- '-n 100000'
- '-c'
- '-E 100'
- '-m benchmarks/minebench/datasets/rsearch/matrices/RIBOSUM85-60.mat'
- 'benchmarks/minebench/datasets/rsearch/Queries/mir-40.stk'
- 'benchmarks/minebench/datasets/rsearch/Databasefile/100Kdb.fa'
4 changes: 4 additions & 0 deletions benchpress/templates/time_wrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -e

/usr/bin/time -p "$@"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Time might not always be in /usr/bin. Maybe just call 'time' and assume its added in the path?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time is a built-in shell command in zsh and bash. /usr/bin/time provides more detailed data. But yes it's true, potentially time might not be installed.

I'll verify with time and see if it's enough. Ideally, Benchpress itself should measure the duration.

14 changes: 14 additions & 0 deletions benchpress/tests/data/plsa_output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Parellel Smith Waterman Algorithm implementation for OpenMP
Threads Number=2
The file 'benchmarks/minebench/datasets/PLSA/pam120.bla' was opened
The file 'benchmarks/minebench/datasets/PLSA/30k_1.txt' was opened
The file 'benchmarks/minebench/datasets/PLSA/30k_2.txt' was opened
Seqence(1) Length=30144, Sequence Length(2)=29696
Adjust block height=17, block width=17
score=101948 x=29567 y=29696 globalstart.i=3 globalstart.j=130
Forward time: 29.22s
BackwardFindPathsForHugeBlock Time: 8.35
Second phase in backward period Time: 6.12

Success!
Total time: 43.69s
121 changes: 121 additions & 0 deletions benchpress/tests/data/rsearch_output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
Random seed: 1524699649
D scale of 2.0
Matrix: RIBOSUM85-60
Alpha: 10.00
Beta: 5.00
Alpha': 0.00
Beta': 15.00
Query file: benchmarks/minebench/datasets/rsearch/Queries/mir-40.stk
Database file: benchmarks/minebench/datasets/rsearch/Databasefile/100Kdb.fa


beginsc = 0.000000
endsc = -15.000000
Making histogram cost 24.8 seconds
Statistics calculated with simulation of 100 samples of length 388
No partition points
GC = 0 lambda = 0.0000 mu = inf
GC = 1 lambda = 0.0000 mu = inf
GC = 2 lambda = 0.0000 mu = inf
GC = 3 lambda = 0.0000 mu = inf
GC = 4 lambda = 0.0000 mu = inf
GC = 5 lambda = 0.0000 mu = inf
GC = 6 lambda = 0.0000 mu = inf
GC = 7 lambda = 0.0000 mu = inf
GC = 8 lambda = 0.0000 mu = inf
GC = 9 lambda = 0.0000 mu = inf
GC = 10 lambda = 0.0000 mu = inf
GC = 11 lambda = 0.0000 mu = inf
GC = 12 lambda = 0.0000 mu = inf
GC = 13 lambda = 0.0000 mu = inf
GC = 14 lambda = 0.0000 mu = inf
GC = 15 lambda = 0.0000 mu = inf
GC = 16 lambda = 0.0000 mu = inf
GC = 17 lambda = 0.0000 mu = inf
GC = 18 lambda = 0.0000 mu = inf
GC = 19 lambda = 0.0000 mu = inf
GC = 20 lambda = 0.0000 mu = inf
GC = 21 lambda = 0.0000 mu = inf
GC = 22 lambda = 0.0000 mu = inf
GC = 23 lambda = 0.0000 mu = inf
GC = 24 lambda = 0.0000 mu = inf
GC = 25 lambda = 0.0000 mu = inf
GC = 26 lambda = 0.0000 mu = inf
GC = 27 lambda = 0.0000 mu = inf
GC = 28 lambda = 0.0000 mu = inf
GC = 29 lambda = 0.0000 mu = inf
GC = 30 lambda = 0.0000 mu = inf
GC = 31 lambda = 0.0000 mu = inf
GC = 32 lambda = 0.0000 mu = inf
GC = 33 lambda = 0.0000 mu = inf
GC = 34 lambda = 0.0000 mu = inf
GC = 35 lambda = 0.0000 mu = inf
GC = 36 lambda = 0.0000 mu = inf
GC = 37 lambda = 0.0000 mu = inf
GC = 38 lambda = 0.0000 mu = inf
GC = 39 lambda = 0.0000 mu = inf
GC = 40 lambda = 0.0000 mu = inf
GC = 41 lambda = 0.0000 mu = inf
GC = 42 lambda = 0.0000 mu = inf
GC = 43 lambda = 0.0000 mu = inf
GC = 44 lambda = 0.0000 mu = inf
GC = 45 lambda = 0.0000 mu = inf
GC = 46 lambda = 0.0000 mu = inf
GC = 47 lambda = 0.0000 mu = inf
GC = 48 lambda = 0.0000 mu = inf
GC = 49 lambda = 0.0000 mu = inf
GC = 50 lambda = 0.0000 mu = inf
GC = 51 lambda = 0.0000 mu = inf
GC = 52 lambda = 0.0000 mu = inf
GC = 53 lambda = 0.0000 mu = inf
GC = 54 lambda = 0.0000 mu = inf
GC = 55 lambda = 0.0000 mu = inf
GC = 56 lambda = 0.0000 mu = inf
GC = 57 lambda = 0.0000 mu = inf
GC = 58 lambda = 0.0000 mu = inf
GC = 59 lambda = 0.0000 mu = inf
GC = 60 lambda = 0.0000 mu = inf
GC = 61 lambda = 0.0000 mu = inf
GC = 62 lambda = 0.0000 mu = inf
GC = 63 lambda = 0.0000 mu = inf
GC = 64 lambda = 0.0000 mu = inf
GC = 65 lambda = 0.0000 mu = inf
GC = 66 lambda = 0.0000 mu = inf
GC = 67 lambda = 0.0000 mu = inf
GC = 68 lambda = 0.0000 mu = inf
GC = 69 lambda = 0.0000 mu = inf
GC = 70 lambda = 0.0000 mu = inf
GC = 71 lambda = 0.0000 mu = inf
GC = 72 lambda = 0.0000 mu = inf
GC = 73 lambda = 0.0000 mu = inf
GC = 74 lambda = 0.0000 mu = inf
GC = 75 lambda = 0.0000 mu = inf
GC = 76 lambda = 0.0000 mu = inf
GC = 77 lambda = 0.0000 mu = inf
GC = 78 lambda = 0.0000 mu = inf
GC = 79 lambda = 0.0000 mu = inf
GC = 80 lambda = 0.0000 mu = inf
GC = 81 lambda = 0.0000 mu = inf
GC = 82 lambda = 0.0000 mu = inf
GC = 83 lambda = 0.0000 mu = inf
GC = 84 lambda = 0.0000 mu = inf
GC = 85 lambda = 0.0000 mu = inf
GC = 86 lambda = 0.0000 mu = inf
GC = 87 lambda = 0.0000 mu = inf
GC = 88 lambda = 0.0000 mu = inf
GC = 89 lambda = 0.0000 mu = inf
GC = 90 lambda = 0.0000 mu = inf
GC = 91 lambda = 0.0000 mu = inf
GC = 92 lambda = 0.0000 mu = inf
GC = 93 lambda = 0.0000 mu = inf
GC = 94 lambda = 0.0000 mu = inf
GC = 95 lambda = 0.0000 mu = inf
GC = 96 lambda = 0.0000 mu = inf
GC = 97 lambda = 0.0000 mu = inf
GC = 98 lambda = 0.0000 mu = inf
GC = 99 lambda = 0.0000 mu = inf
GC = 100 lambda = 0.0000 mu = inf
N = 235320
Using E cutoff of 10.00
we cost 225.7 seconds totally, 24.8 for making histogram
Fin
Loading