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
26 changes: 26 additions & 0 deletions benchpress/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,29 @@ silo:
- latency:
- avg_latency

gapbs_bc:
parser: gapbs
path: ./benchmarks/gapbs/bc
metrics:
- generate_time
- build_time
- trial_time
- average_time

gapbs_bfs:
parser: gapbs
path: ./benchmarks/gapbs/bfs
metrics:
- generate_time
- build_time
- trial_time
- average_time

gapbs_tc:
parser: gapbs
path: ./benchmarks/gapbs/tc
metrics:
- generate_time
- build_time
- trial_time
- average_time
2 changes: 2 additions & 0 deletions benchpress/benchpress/plugins/parsers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# of patent rights can be found in the PATENTS file in the same directory.

from .fio import FioParser
from .gapbs import GAPBSParser
from .generic import JSONParser
from .ltp import LtpParser
from .returncode import ReturncodeParser
Expand All @@ -16,6 +17,7 @@

def register_parsers(factory):
factory.register('fio', FioParser)
factory.register('gapbs', GAPBSParser)
factory.register('json', JSONParser)
factory.register('ltp', LtpParser)
factory.register('returncode', ReturncodeParser)
Expand Down
27 changes: 27 additions & 0 deletions benchpress/benchpress/plugins/parsers/gapbs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (c) 2017-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

TIME_REGEX = r'(\w+\sTime):\s+(\d+\.?\d*)'


class GAPBSParser(Parser):

def parse(self, stdout, stderr, returncode):
output = ' '.join(stdout)
metrics = {}
times = re.findall(TIME_REGEX, output)
for t in times:
key = self.snakeify_name(t[0])
metrics[key] = float(t[1])
return metrics

def snakeify_name(self, s):
return '_'.join(s.strip().lower().split())
22 changes: 22 additions & 0 deletions benchpress/install_gapbs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

GAP_GIT_REPO="https://github.com/sbeamer/gapbs.git"
GAP_GIT_TAG="tags/v1.1"

BENCHMARKS_DIR="$(pwd)/benchmarks/gapbs"
mkdir -p "$BENCHMARKS_DIR"

rm -rf build
mkdir -p build
cd build

git clone "$GAP_GIT_REPO"
cd gapbs
git checkout -b gapbs_benchpress "$GAP_GIT_TAG"
make

mv tc sssp pr converter cc bfs bc "$BENCHMARKS_DIR"
cd ../../
rm -rf build

echo "GAP benchmark suite installed into ${BENCHMARKS_DIR}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where are you providing the compile commands for the 3 gap benchmarks ?

Copy link
Owner Author

Choose a reason for hiding this comment

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

The make command on line 16 builds all benchmarks. By default it compiles with -O3 flag, I think in the script you shared with me you compiled with -O2. Do you want to switch to -O2 ?

22 changes: 21 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,23 @@
scale-factor: 1
runtime: 1

- benchmark: gapbs_bc
Copy link
Collaborator

Choose a reason for hiding this comment

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

This benchmark uses OpenMP. Do you think we should let it default OMP threads or we should specify that as one of the benchmark inputs?

Copy link
Owner Author

@meteorfox meteorfox Jun 22, 2018

Choose a reason for hiding this comment

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

Today, the user can set the OMP_NUM_THREADS variable in their shell, and the benchmark should pick it up.

Example:

$ OMP_NUM_THREADS=1 python3.6 ./benchpress_cli.py -b benchmarks.yml -j jobs/jobs.yml run gapbs_bfs
Will run 1 job(s)
Running "gapbs_bfs": GAP bfs benchmark
{
  "average_time": 0.09154,
  "build_time": 8.41545,
  "generate_time": 1.42859,
  "trial_time": 0.09154
}

But to be more explicit, we could potentially add support for environment variables, perhaps something like:

benchmark: gapbs_bc
  name: gapbs_bc
  description: GAP bc benchmark
  env:
    OMP_NUM_THREADS: 4
  args:
    - -u 21
    - -n 1

name: gapbs_bc
description: GAP bc benchmark
args:
- -u 21
- -n 1

- benchmark: gapbs_bfs
name: gapbs_bfs
description: GAP bfs benchmark
args:
- -u 21
- -n 1

- benchmark: gapbs_tc
name: gapbs_tc
description: GAP tc benchmark
args:
- -u 21
- -n 1
82 changes: 82 additions & 0 deletions benchpress/tests/test_gapbs_parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Copyright (c) 2017-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 unittest

from benchpress.plugins.parsers.gapbs import GAPBSParser


class TestGAPBSParser(unittest.TestCase):

def setUp(self):
self.parser = GAPBSParser()

def test_bc_sample_output(self):
output = [
'Generate Time: 0.41289',
'Build Time: 1.89460',
'Graph has 1048576 nodes and 16776968 undirected edges for degree: 15',
' a 0.00035',
'source: 209629',
' b 0.45253',
' p 0.31504',
'Trial Time: 0.76991',
'Average Time: 0.76991',
]
metrics = self.parser.parse(output, None, 0)
self.assertDictEqual({
'generate_time': 0.41289,
'build_time': 1.89460,
'trial_time': 0.76991,
'average_time': 0.76991,
}, metrics)

def test_bfs_sample_ouput(self):
output = [
'Generate Time: 0.41075',
'Build Time: 1.89220',
'Graph has 1048576 nodes and 16776968 undirected edges for degree: 15',
'Source: 209629',
' i 0.00086',
' td 29 0.00003',
' td 872 0.00002',
' td 27534 0.00049',
' td 579473 0.01030',
' e 0.00445',
' bu 440667 0.01020',
' bu 0 0.00044',
' c 0.00073',
'Trial Time: 0.02800',
'Average Time: 0.02800',
]
metrics = self.parser.parse(output, None, 0)
self.assertDictEqual({
'generate_time': 0.41075,
'build_time': 1.89220,
'trial_time': 0.02800,
'average_time': 0.02800,
}, metrics)

def test_tc_sample_output(self):
output = [
'Generate Time: 0.40949',
'Build Time: 1.88401',
'Graph has 1048576 nodes and 16776968 undirected edges for degree: 15',
'Trial Time: 2.45414',
'Average Time: 2.45414',
]
metrics = self.parser.parse(output, None, 0)
self.assertDictEqual({
'generate_time': 0.40949,
'build_time': 1.88401,
'trial_time': 2.45414,
'average_time': 2.45414,
}, metrics)


if __name__ == '__main__':
unittest.main()