aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2020-07-13 17:17:20 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2020-07-13 17:17:20 +0200
commit0825b2b53406bb4acf9d3857a1f846efa845877e (patch)
tree72b43dcaf0c3d7d0b9f7028553c2bf71f8a4b3df
parent20eb9d1661c058476f80728b92956a76f035a27d (diff)
downloadallocbench-0825b2b53406bb4acf9d3857a1f846efa845877e.tar.gz
allocbench-0825b2b53406bb4acf9d3857a1f846efa845877e.zip
[refactoring] fix or ignore many pylint hints
* Add missing docstrings * Remove unused imports * fix line-to-long * fix some typos * ignore global-statement * ignore wrong-import-order for scripts under /scripts
-rw-r--r--allocbench/allocator.py2
-rw-r--r--allocbench/allocators/bumpptr.py1
-rw-r--r--allocbench/allocators/paper.py4
-rw-r--r--allocbench/allocators/tbbmalloc.py3
-rw-r--r--allocbench/allocators/tcmalloc.py7
-rw-r--r--allocbench/artifact.py2
-rw-r--r--allocbench/benchmarks/lld.py4
-rw-r--r--allocbench/benchmarks/mysql.py1
-rw-r--r--allocbench/directories.py2
-rw-r--r--allocbench/plots.py1
-rw-r--r--allocbench/util.py17
-rwxr-xr-xbench.py1
-rwxr-xr-xmerge.py5
-rwxr-xr-xscripts/paper_plots.py9
-rwxr-xr-xscripts/print_facts.py3
-rwxr-xr-xsummarize.py2
16 files changed, 43 insertions, 21 deletions
diff --git a/allocbench/allocator.py b/allocbench/allocator.py
index 27e137e..e039a7c 100644
--- a/allocbench/allocator.py
+++ b/allocbench/allocator.py
@@ -166,7 +166,7 @@ class Allocator:
shell=True)
except CalledProcessError as err:
logger.debug("%s", err.stderr)
- logger.error("Builing %s failed", self.name)
+ logger.error("Building %s failed", self.name)
shutil.rmtree(self.dir, ignore_errors=True)
raise
diff --git a/allocbench/allocators/bumpptr.py b/allocbench/allocators/bumpptr.py
index 84097b1..b1b997c 100644
--- a/allocbench/allocators/bumpptr.py
+++ b/allocbench/allocators/bumpptr.py
@@ -21,7 +21,6 @@ memory in speeds favor. Memory is mmapped per thread and never freed.
See allocbench/bumpptr.c for the actual implementation.
"""
-import os
from allocbench.allocator import Allocator
from allocbench.directories import get_allocbench_allocator_build_dir
diff --git a/allocbench/allocators/paper.py b/allocbench/allocators/paper.py
index f4aa44a..a22dc80 100644
--- a/allocbench/allocators/paper.py
+++ b/allocbench/allocators/paper.py
@@ -17,12 +17,14 @@
"""Collection containing all available allocators"""
from allocbench.allocators.glibc import glibc
-from allocbench.allocators.tcmalloc import tcmalloc, tcmalloc_align, tcmalloc_gperftools, tcmalloc_gperftools_align
from allocbench.allocators.jemalloc import jemalloc
from allocbench.allocators.llalloc import llalloc
from allocbench.allocators.mimalloc import mimalloc
from allocbench.allocators.bumpptr import bumpptr
from allocbench.allocators.speedymalloc import speedymalloc
+from allocbench.allocators.tcmalloc import (tcmalloc, tcmalloc_align,
+ tcmalloc_gperftools,
+ tcmalloc_gperftools_align)
# pylint: disable=invalid-name
allocators = [
diff --git a/allocbench/allocators/tbbmalloc.py b/allocbench/allocators/tbbmalloc.py
index 2df3b0e..f825d03 100644
--- a/allocbench/allocators/tbbmalloc.py
+++ b/allocbench/allocators/tbbmalloc.py
@@ -29,7 +29,8 @@ class TBBMalloc(Allocator):
self.ld_preload = "{dir}/libtbbmalloc.so"
self.build_cmds = [
"cd {srcdir}; make tbbmalloc -j4", "mkdir -p {dir}",
- 'ln -f -s $(find {srcdir} -executable -name "*libtbbmalloc_proxy.so*" | head -1) {dir}/libtbbmalloc.so'
+ ('ln -f -s $(find {srcdir} -executable -name "*libtbbmalloc_proxy.so*"'
+ ' | head -1) {dir}/libtbbmalloc.so')
]
super().__init__(name, **kwargs)
diff --git a/allocbench/allocators/tcmalloc.py b/allocbench/allocators/tcmalloc.py
index ee15a9d..9b370c1 100644
--- a/allocbench/allocators/tcmalloc.py
+++ b/allocbench/allocators/tcmalloc.py
@@ -48,7 +48,9 @@ tcmalloc_align = TCMalloc("TCMalloc-Aligned",
version="1676100265bd189df6b5513feac15f102542367e",
color="xkcd:light blue")
-tcmalloc_align.ld_preload = f"{get_allocbench_allocator_build_dir()}/align_to_cl.so {tcmalloc_align.ld_preload}"
+align_to_cl_location = f"{get_allocbench_allocator_build_dir()}/align_to_cl.so"
+
+tcmalloc_align.ld_preload = f"{align_to_cl_location} {tcmalloc_align.ld_preload}"
# pylint: enable=invalid-name
@@ -86,8 +88,7 @@ tcmalloc_gperftools_align = TCMallocGperftools("TCMalloc-Gperftools-Aligned",
color="xkcd:navy blue")
tcmalloc_gperftools_align.ld_preload = (
- f"{get_allocbench_allocator_build_dir()}/align_to_cl.so "
- f"{tcmalloc_gperftools_align.ld_preload}")
+ f"{align_to_cl_location} {tcmalloc_gperftools_align.ld_preload}")
tcmalloc_gperftools_cacheline_exclusive = TCMallocGperftools(
"TCMalloc-Gperftools-Cacheline-Exclusive",
diff --git a/allocbench/artifact.py b/allocbench/artifact.py
index 084b403..a0efd1b 100644
--- a/allocbench/artifact.py
+++ b/allocbench/artifact.py
@@ -33,7 +33,7 @@ ARTIFACT_STORE_DIR = get_allocbench_base_dir() / "cache"
logger = logging.getLogger(__file__)
-class Artifact:
+class Artifact: # pylint: disable=too-few-public-methods
"""Base class for external ressources"""
def __init__(self, name):
self.name = name
diff --git a/allocbench/benchmarks/lld.py b/allocbench/benchmarks/lld.py
index d71e911..2e63a32 100644
--- a/allocbench/benchmarks/lld.py
+++ b/allocbench/benchmarks/lld.py
@@ -208,6 +208,9 @@ import allocbench.facter as facter
class BenchmarkLld(Benchmark):
"""LLVM-lld speed benchmark definition"""
+
+ requirements = ["ld.lld"]
+
def __init__(self):
name = "lld"
@@ -225,7 +228,6 @@ class BenchmarkLld(Benchmark):
self.measure_cmd = "perf stat -x, -d time -f %M,KB,VmHWM"
self.measure_cmd_csv = True
- self.requirements = ["ld.lld"]
self.tests_artifact = ArchiveArtifact(
"lld-speed-test",
diff --git a/allocbench/benchmarks/mysql.py b/allocbench/benchmarks/mysql.py
index e2f7c71..db5351f 100644
--- a/allocbench/benchmarks/mysql.py
+++ b/allocbench/benchmarks/mysql.py
@@ -77,7 +77,6 @@ import os
import re
import shutil
from subprocess import CalledProcessError
-import sys
from allocbench.benchmark import Benchmark
import allocbench.facter as facter
diff --git a/allocbench/directories.py b/allocbench/directories.py
index 3c76f0f..c9c1006 100644
--- a/allocbench/directories.py
+++ b/allocbench/directories.py
@@ -87,7 +87,7 @@ RESDIR = None
def set_current_result_dir(resdir: Union[Path, str]):
"""Set the path to the result directory of the current invocation and silently create it"""
- global RESDIR
+ global RESDIR # pylint: disable=global-statement
RESDIR = Path(resdir)
RESDIR.mkdir(parents=True, exist_ok=True)
diff --git a/allocbench/plots.py b/allocbench/plots.py
index c2a9aa0..9735519 100644
--- a/allocbench/plots.py
+++ b/allocbench/plots.py
@@ -609,6 +609,7 @@ def create_ascii_leaderboards(bench, datapoints: List[Tuple[str, str]]):
def calc_ttests_for_alloc_pair(bench, alloc1, alloc2, datapoint: str) -> Dict:
+ """Calculate independent t-test between two allocators for each argument permutation"""
ttest_results = {}
for perm in bench.iterate_args():
data1 = [float(m[datapoint]) for m in bench.results[alloc1][perm]]
diff --git a/allocbench/util.py b/allocbench/util.py
index 73bdd9a..cb84fb4 100644
--- a/allocbench/util.py
+++ b/allocbench/util.py
@@ -35,20 +35,21 @@ def set_verbosity(verbosity: int):
"""
loglevels = [logging.ERROR, logging.INFO, logging.DEBUG]
logging.basicConfig(level=loglevels[verbosity])
- global VERBOSITY
+ global VERBOSITY # pylint: disable = global-statement
VERBOSITY = verbosity
logger = logging.getLogger(__file__)
-def run_cmd(cmd,
- output_verbosity=2,
- capture=False,
- shell=False,
- check=True,
- cwd=None,
- input=None): # pylint: disable=redefined-builtin
+def run_cmd( # pylint: disable=too-many-arguments
+ cmd,
+ output_verbosity=2,
+ capture=False,
+ shell=False,
+ check=True,
+ cwd=None,
+ input=None): # pylint: disable=redefined-builtin
"""subprocess.run wrapper which cares about the set verbosity"""
if capture:
stdout = subprocess.PIPE
diff --git a/bench.py b/bench.py
index e43ad1c..a234544 100755
--- a/bench.py
+++ b/bench.py
@@ -69,6 +69,7 @@ def check_dependencies():
def main():
+ """Main entry point for an allocbench benchmark run"""
check_dependencies()
parser = argparse.ArgumentParser(description="benchmark memory allocators")
diff --git a/merge.py b/merge.py
index 185183f..51dd774 100755
--- a/merge.py
+++ b/merge.py
@@ -28,11 +28,16 @@ from allocbench.util import print_license_and_exit
def load_file(filename):
+ """Load a json file"""
with open(filename, "r") as json_file:
return json.load(json_file)
def main():
+ """Merge the two allocbench benchmark results
+
+ For each benchmark result included in both result directories all
+ missing allocators in the first results are copied from the second."""
if "--license" in sys.argv:
print_license_and_exit()
diff --git a/scripts/paper_plots.py b/scripts/paper_plots.py
index 9d193bf..d34141d 100755
--- a/scripts/paper_plots.py
+++ b/scripts/paper_plots.py
@@ -27,12 +27,14 @@ currentdir = os.path.dirname(os.path.abspath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
+# pylint: disable=wrong-import-position
from allocbench.allocators.paper import allocators as paper_allocators
from allocbench.benchmark import get_benchmark_object
from allocbench.directories import get_current_result_dir, set_current_result_dir
import allocbench.facter as facter
import allocbench.plots as plt
from allocbench.util import print_status, set_verbosity, print_license_and_exit
+# pylint: enable=wrong-import-position
logger = logging.getLogger(__file__)
@@ -48,6 +50,7 @@ ALIGNED_ALLOCATORS = [
def falsesharing_plots(falsesharing):
+ """Create falsesharing tikz plots"""
args = falsesharing.results["args"]
falsesharing.results["allocators"] = {
@@ -93,6 +96,7 @@ def falsesharing_plots(falsesharing):
def blowup_plots(blowup):
+ """Create blowup bar plot including ideal rss"""
args = blowup.results["args"]
blowup.results["allocators"] = {
k: v
@@ -126,6 +130,7 @@ def blowup_plots(blowup):
def loop_plots(loop):
+ """Create simple loop throughput tikz plot for 40 threads"""
args = loop.results["args"]
loop.results["allocators"] = {
k: v
@@ -143,8 +148,8 @@ def loop_plots(loop):
def mysqld_plots(mysql):
+ """Create transactions and VmHWM tikz plots"""
args = mysql.results["args"]
- # mysql.results["allocators"] = {k: v for k, v in mysql.results["allocators"].items() if k in SURVEY_ALLOCATORS}
plt.pgfplot(mysql,
mysql.iterate_args(args),
@@ -170,6 +175,7 @@ def mysqld_plots(mysql):
def keydb_plots(keydb):
+ """Create throughput tikz bar plot"""
args = keydb.results["args"]
keydb.results["allocators"] = {
k: v
@@ -229,6 +235,7 @@ def summarize(benchmarks=None, exclude_benchmarks=None):
def main():
+ """Main entry point for WIP paper plot creation"""
parser = argparse.ArgumentParser(
description="Summarize allocbench results in allocator sets")
parser.add_argument("results", help="path to results", type=str)
diff --git a/scripts/print_facts.py b/scripts/print_facts.py
index dfb07a6..4a057f7 100755
--- a/scripts/print_facts.py
+++ b/scripts/print_facts.py
@@ -26,12 +26,15 @@ CURRENTDIR = os.path.dirname(os.path.abspath(__file__))
PARENTDIR = os.path.dirname(CURRENTDIR)
sys.path.insert(0, PARENTDIR)
+# pylint: disable=wrong-import-position
from allocbench.benchmark import AVAIL_BENCHMARKS, get_benchmark_object
import allocbench.facter as facter
from allocbench.plots import print_facts, print_common_facts
+# pylint: enable=wrong-import-position
def main():
+ """Print facts about an allocbench benchmark results"""
parser = argparse.ArgumentParser(
description="Print facts about an allocbench result directory")
parser.add_argument("results", help="path to allocbench results", type=str)
diff --git a/summarize.py b/summarize.py
index 2c1a27c..df5c464 100755
--- a/summarize.py
+++ b/summarize.py
@@ -208,7 +208,7 @@ def main():
allocbench.plots.latex_custom_preamble = args.latex_preamble
if not os.path.isdir(args.results):
- logger.critical(f"%s is no directory", args.results)
+ logger.critical("%s is no directory", args.results)
sys.exit(1)
set_current_result_dir(args.results)