-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2d05973
Showing
22 changed files
with
3,188 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
docker: | ||
- image: continuumio/miniconda3 | ||
|
||
working_directory: ~/repo | ||
|
||
steps: | ||
- checkout | ||
|
||
|
||
# - restore_cache: | ||
# keys: | ||
# - v1-dependencies-{{ checksum "environment.yml" }} | ||
# - v1-dependencies- | ||
|
||
|
||
- run: | ||
name: install dependencies | ||
command: | | ||
# conda env create -q || conda env update -q | ||
# source activate adj | ||
conda install -qy conda-build anaconda-client pytest pytest-cov | ||
conda config --set auto_update_conda no | ||
conda info -a | ||
conda build conda.recipe --no-test | ||
conda install --use-local lazyprofiler | ||
# - save_cache: | ||
# paths: | ||
# - /opt/conda | ||
# key: v1-dependencies-{{ checksum "environment.yml" }} | ||
|
||
|
||
- run: | ||
name: run tests | ||
command: | | ||
# source activate adj | ||
pytest --color=yes -v --cov=lazyprofiler tests | ||
conda install -c conda-forge codecov | ||
codecov | ||
- store_artifacts: | ||
path: test-reports | ||
destination: test-reports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
exclude_paths: | ||
- 'lazyprofiler/_version.py' | ||
- 'tests/**/*' | ||
- 'tests/*' | ||
- 'benchmarks/**/*' | ||
- 'setup.py' | ||
- 'versioneer.py' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[report] | ||
omit = | ||
setup.py | ||
lazyprofiler/__main__.py | ||
lazyprofiler/_version.py | ||
versioneer.py | ||
tests/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
lazyprofiler/_version.py export-subst | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# pyenv python configuration file | ||
.python-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Config file for automatic testing at travis-ci.org | ||
|
||
language: python | ||
python: | ||
- "2.7" | ||
- "3.6" | ||
- "3.7" | ||
- "3.8" | ||
- "3.9" | ||
|
||
install: | ||
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then | ||
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh; | ||
else | ||
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; | ||
fi | ||
- bash miniconda.sh -b -p $HOME/miniconda | ||
- export PATH="$HOME/miniconda/bin:$PATH" | ||
- hash -r | ||
- conda config --set always_yes yes | ||
- conda update -q conda | ||
- conda install conda-build anaconda-client pytest pytest-cov | ||
- conda config --set auto_update_conda no | ||
- conda build conda.recipe --no-test | ||
- conda install --use-local lazyprofiler | ||
- conda info -a | ||
script: | ||
- pytest -v --color=yes --cov=lazyprofiler tests | ||
after_success: | ||
- conda install -c conda-forge codecov | ||
- codecov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021, Shankar Rao Pandala | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include versioneer.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
=============================== | ||
lazyprofiler | ||
=============================== | ||
|
||
|
||
.. image:: https://img.shields.io/travis/shankarpandala/lazyprofiler.svg | ||
:target: https://travis-ci.org/shankarpandala/lazyprofiler | ||
.. image:: https://circleci.com/gh/shankarpandala/lazyprofiler.svg?style=svg | ||
:target: https://circleci.com/gh/shankarpandala/lazyprofiler | ||
.. image:: https://codecov.io/gh/shankarpandala/lazyprofiler/branch/master/graph/badge.svg | ||
:target: https://codecov.io/gh/shankarpandala/lazyprofiler | ||
|
||
|
||
Lazy Profiler is a simple utility to collect CPU, GPU, RAM and GPU Memory stats while the program is running. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
environment: | ||
global: | ||
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the | ||
# /E:ON and /V:ON options are not enabled in the batch script intepreter | ||
# See: http://stackoverflow.com/a/13751649/163740 | ||
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\tools\\appveyor\\run_with_env.cmd" | ||
|
||
matrix: | ||
- PYTHON: "C:\\Miniconda36-x64" | ||
PYTHON_VERSION: "3.6" | ||
PYTHON_ARCH: "64" | ||
|
||
- PYTHON: "C:\\Miniconda36-x64" | ||
PYTHON_VERSION: "3.7" | ||
PYTHON_ARCH: "64" | ||
|
||
- PYTHON: "C:\\Miniconda36-x64" | ||
PYTHON_VERSION: "3.8" | ||
PYTHON_ARCH: "64" | ||
|
||
- PYTHON: "C:\\Miniconda36-x64" | ||
PYTHON_VERSION: "3.9" | ||
PYTHON_ARCH: "64" | ||
|
||
- PYTHON: "C:\\Miniconda-x64" | ||
PYTHON_VERSION: "2.7" | ||
PYTHON_ARCH: "64" | ||
|
||
init: | ||
- ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH% %HOME% | ||
|
||
|
||
install: | ||
# If there is a newer build queued for the same PR, cancel this one. | ||
# The AppVeyor 'rollout builds' option is supposed to serve the same | ||
# purpose but it is problematic because it tends to cancel builds pushed | ||
# directly to master instead of just PR builds (or the converse). | ||
# credits: JuliaLang developers. | ||
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` | ||
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` | ||
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` | ||
throw "There are newer queued builds for this pull request, failing early." } | ||
# these correspond to folder naming of miniconda installs on appveyor. See | ||
# https://www.appveyor.com/docs/installed-software#python | ||
- if "%PYTHON_VERSION%" == "3.6" set "BASE_PYTHON_VERSION=36" | ||
- if "%PYTHON_ARCH%" == "64" set "ARCH_LABEL=-x64" | ||
- call "C:\Miniconda%BASE_PYTHON_VERSION%%ARCH_LABEL%\Scripts\activate.bat" | ||
- conda config --set always_yes yes | ||
- conda update -q conda | ||
- conda config --set auto_update_conda no | ||
- conda update -q --all | ||
- conda install -q pytest pytest-cov conda-build anaconda-client | ||
- conda info | ||
# this is to ensure dependencies | ||
- conda build conda.recipe --no-test | ||
- conda install --use-local lazyprofiler | ||
|
||
|
||
# Not a .NET project, we build package in the install step instead | ||
build: false | ||
|
||
test_script: | ||
- py.test --color=yes -v --cov lazyprofiler --cov-report xml tests | ||
|
||
on_success: | ||
- conda install -c conda-forge codecov | ||
- codecov --env PYTHON_VERSION --file C:\projects\lazyprofiler\coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
{% set data = load_setup_py_data() %} | ||
|
||
package: | ||
name: lazyprofiler | ||
|
||
version: {{ data['version'] }} | ||
|
||
source: | ||
path: .. | ||
|
||
build: | ||
# If the installation is complex, or different between Unix and Windows, use | ||
# separate bld.bat and build.sh files instead of this key. Add the line | ||
# "skip: True # [py<35]" (for example) to limit to Python 3.5 and newer, or | ||
# "skip: True # [not win]" to limit to Windows. | ||
script: {{ PYTHON }} -m pip install --no-deps --ignore-installed -vv . | ||
noarch: python | ||
|
||
entry_points: | ||
{% for entry in data['entry_points']['console_scripts'] %} | ||
- {{ entry.split('=')[0].strip() }} = {{ entry.split('=')[1].strip() }} | ||
{% endfor %} | ||
|
||
|
||
requirements: | ||
# if you need compilers, uncomment these | ||
# read more at https://docs.conda.io/projects/conda-build/en/latest/resources/compiler-tools.html | ||
# build: | ||
# - {{ compilers('c') }} | ||
host: | ||
- python | ||
- pip | ||
run: | ||
- python | ||
# dependencies are defined in setup.py | ||
{% for dep in data['install_requires'] %} | ||
- {{ dep.lower() }} | ||
{% endfor %} | ||
{# raw is for ignoring templating with cookiecutter, leaving it for use with conda-build #} | ||
|
||
test: | ||
source_files: | ||
- tests | ||
requires: | ||
- pytest | ||
- pytest-cov | ||
commands: | ||
- pytest tests | ||
|
||
about: | ||
home: https://github.com/shankarpandala/lazyprofiler | ||
summary: Lazy Profiler is a simple utility to collect CPU, GPU, RAM and GPU Memorystats while the program is running. | ||
license: {{ data.get('license') }} | ||
license_file: LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import subprocess | ||
import os | ||
import pandas as pd | ||
import math | ||
|
||
def start_log(file_name = None): | ||
if file_name is not None: | ||
if os.path.isfile(file_name+'.csv'): | ||
os.remove(file_name+'.csv') | ||
logger_fname = file_name+'.csv' | ||
else: | ||
if os.path.isfile('log_compute.csv'): | ||
os.remove('log_compute.csv') | ||
logger_fname = 'log_compute.csv' | ||
logger_pid = subprocess.Popen( | ||
['python', 'log_gpu_cpu_stats.py', | ||
logger_fname, | ||
'--loop', '0.2', # Interval between measurements, in seconds (optional, default=1) | ||
]) | ||
|
||
print('Started logging compute utilisation') | ||
return logger_pid | ||
|
||
def stop_log(pid=None): | ||
pid.terminate() | ||
print('Terminated the compute utilisation logger background process') | ||
|
||
def plot_stats(file_name = None, save_plot=False): | ||
if file_name is not None: | ||
logger_fname = file_name+'.csv' | ||
else: | ||
logger_fname = 'log_compute.csv' | ||
log_data = pd.read_csv(logger_fname) | ||
log_data['Timestamp (s)'] = pd.to_datetime(log_data['Timestamp (s)'],unit='s') | ||
log_data.set_index('Timestamp (s)',inplace =True) | ||
plot_rows = int(math.ceil(len(log_data.columns)/3)) | ||
|
||
if save_plot is True: | ||
return log_data.plot(subplots=True,layout=(plot_rows,3),figsize=(16,4*plot_rows)) | ||
else: | ||
log_data.plot(subplots=True,layout=(plot_rows,3),figsize=(16,4*plot_rows)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from ._version import get_versions | ||
__version__ = get_versions()['version'] | ||
del get_versions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from lazyprofiler import cli | ||
|
||
cli.cli() |
Oops, something went wrong.