Unverified Commit 00bf22b5 authored by narugo1992's avatar narugo1992 Committed by GitHub
Browse files

Merge pull request #11 from deepghs/doc/benchmark

doc(narugo): add benchmark for docs
parents 5a2715ed 4d3fe8fd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ jobs:
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          branch: ${{ github.ref }}

  doc:
    runs-on: ubuntu-latest
@@ -130,6 +131,7 @@ jobs:
          ENV_PROD: 'true'
          PLANTUML_HOST: http://localhost:18080
        run: |
          git pull
          git fetch --all --tags
          git branch -av
          git remote -v
+1 −1
Original line number Diff line number Diff line
@@ -1205,7 +1205,7 @@ fabric.properties
/docs/source/**/*.sh.err
/docs/source/**/*.sh.exitcode
/docs/source/**/*.dat.*
!/docs/source/**/*.bm.*
!/docs/source/**/*.benchmark.py.*
!/docs/source/_static/**/*
/docs/source/**/*.result.ipynb
/cartpole_dqn_*
+6 −1
Original line number Diff line number Diff line
@@ -11,6 +11,8 @@ BUILDDIR ?= ${PROJ_DIR}/build
ALL_MK := ${SOURCEDIR}/all.mk
ALL    := $(MAKE) -f "${ALL_MK}" SOURCE=${SOURCEDIR}

BMS    := $(shell find ${SOURCEDIR} -name 'benchmark_*.dat.*')

.EXPORT_ALL_VARIABLES:

NO_CONTENTS_BUILD = true
@@ -42,3 +44,6 @@ sourcedir:
	@echo $(shell readlink -f ${SOURCEDIR})
builddir:
	@echo $(shell readlink -f ${BUILDDIR}/html)

cleanbm:
	$(ALL) cleanbm
+47 −40
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ import warnings
from multiprocessing import Process
from typing import Tuple, List

import click
import matplotlib.pyplot as plt
import numpy as np
import psutil
@@ -93,7 +94,7 @@ class BaseBenchmark:
        return final_mems, final_times, final_labels


def create_plot(items: List[Tuple[str, BaseBenchmark]], save_as: str,
def create_plot_cli(items: List[Tuple[str, BaseBenchmark]],
                    title: str = 'Unnamed Benchmark Plot', run_times=15, try_times=10,
                    mem_ylog: bool = False, time_ylog: bool = False,
                    figsize=(720, 420), dpi: int = 300):
@@ -113,6 +114,10 @@ def create_plot(items: List[Tuple[str, BaseBenchmark]], save_as: str,
        else:
            return f'{x * 1.0:.1f}s'

    @click.command()
    @click.option('--output', '-o', 'save_as', type=click.Path(dir_okay=False), required=True,
                  help='Output path of image file.', show_default=True)
    def _execute(save_as):
        fig, axes = plt.subplots(1, 2, figsize=(figsize[0] / INCHES_TO_PIXELS, figsize[1] / INCHES_TO_PIXELS))

        if mem_ylog:
@@ -149,3 +154,5 @@ def create_plot(items: List[Tuple[str, BaseBenchmark]], save_as: str,

        fig.tight_layout()
        plt.savefig(save_as, bbox_inches='tight', dpi=dpi, transparent=True)

    return _execute
+2 −0
Original line number Diff line number Diff line
@@ -45,3 +45,5 @@ clean:
	@$(DEMOS) clean
	@$(NOTEBOOK) clean

cleanbm:
	@$(DEMOS) cleanbm
Loading