From 647667d7831f67454f7a74f56a0a1ec65e03cc6a Mon Sep 17 00:00:00 2001 From: Yifan Zhao <yifanz16@illinois.edu> Date: Sat, 3 Apr 2021 21:50:43 -0500 Subject: [PATCH] Fixed docstring and autotyping --- hpvm/docs/conf.py | 10 ++++---- hpvm/docs/requirements.txt | 1 - .../hpvm-profiler/hpvm_profiler/__init__.py | 23 ++++++++++--------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/hpvm/docs/conf.py b/hpvm/docs/conf.py index 0bea2f5e53..238128340d 100644 --- a/hpvm/docs/conf.py +++ b/hpvm/docs/conf.py @@ -4,10 +4,9 @@ from datetime import date # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -import os import sys - -sys.path.insert(0, os.path.abspath("..")) +from pathlib import Path +sys.path.insert(0, Path("../projects/hpvm-profiler").absolute().as_posix()) # General configuration # --------------------- @@ -17,16 +16,15 @@ sys.path.insert(0, os.path.abspath("..")) extensions = [ "sphinx.ext.autosummary", "sphinx.ext.autodoc", - "sphinx_autodoc_typehints", "sphinx.ext.coverage", "sphinx.ext.doctest", "sphinx.ext.intersphinx", "sphinx.ext.mathjax", "sphinx.ext.todo", "sphinx.ext.viewcode", - "numpydoc", ] -always_document_param_types = True + +autodoc_typehints = "description" # generate autosummary pages autosummary_generate = True diff --git a/hpvm/docs/requirements.txt b/hpvm/docs/requirements.txt index 44ae898e55..d4dc1a6039 100644 --- a/hpvm/docs/requirements.txt +++ b/hpvm/docs/requirements.txt @@ -1,4 +1,3 @@ sphinx>=3.5 -sphinx-autodoc-typehints>=1.11 pydata-sphinx-theme==0.5.2 numpydoc>=1.1 \ No newline at end of file diff --git a/hpvm/projects/hpvm-profiler/hpvm_profiler/__init__.py b/hpvm/projects/hpvm-profiler/hpvm_profiler/__init__.py index baaf645cb9..b421071aaf 100644 --- a/hpvm/projects/hpvm-profiler/hpvm_profiler/__init__.py +++ b/hpvm/projects/hpvm-profiler/hpvm_profiler/__init__.py @@ -16,19 +16,20 @@ def profile_config_file( profile_filename: str = "profile_info.txt", qos_filename: str = "final_accuracy", ) -> None: - """ - Profile an HPVM configuration file with an HPVM binary. + r"""Profile an HPVM configuration file with an HPVM binary, + and write the updated configuration file to a given location. The configuration file must have the baseline as the first configuration. - binary_path: Path to binary to be executed in profiling. - config_path: Path to config file (HPVM configuration format) + :param binary_path: Path to binary to be executed in profiling. + :param config_path: Path to config file (HPVM configuration format) with configs to enumerate for profiling. - output_config_path: Path where the output configs are written. + :param output_config_path: Path where the output configs are written. The output config file has the same configs as the input `config_path` file, but the performance and energy readings are updated. - profile_filename: Name of profile file generated by the binary (in current directory). + :param progress_bar: If `True`, show a progress bar for number of configs already profiled. + :param profile_filename: Name of profile file generated by the binary (in current directory). This defaults to "profile_info.txt" and should not be changed for HPVM binaries. - qos_filename: Name of QoS file generated by the binary (in current directory). + :param qos_filename: Name of QoS file generated by the binary (in current directory). It contains a single float number as the QoS of this run. This defaults to "final_accuracy" and should not be changed for HPVM binaries. """ @@ -109,11 +110,11 @@ def plot_hpvm_configs( to obtain real speedup numbers. This function creates a `matplotlib.pyplot.Figure`, plots on it, and returns it. - config_path: Path to the config file (HPVM configuration format). - save_to: File to save figure into. Default is None: don't save figure (just return it). - show_qos_loss: Show the loss of QoS on x axis of the figure. Defaults to True. + :param config_path: Path to the config file (HPVM configuration format). + :param save_to: File to save figure into. Default is None: don't save figure (just return it). + :param show_qos_loss: Show the loss of QoS on x axis of the figure. Defaults to True. If False, will use (absolute) QoS instead of QoS loss. - fig_kwargs: Arguments to pass to `plt.subplots`. + :param fig_kwargs: Arguments to pass to `plt.subplots`. """ import numpy as np -- GitLab