2021-01-28 16:01:28 +03:00
|
|
|
# Copyright (c) Microsoft Corporation.
|
|
|
|
# Licensed under the MIT License.
|
|
|
|
|
|
|
|
"""The setuptools based setup module.
|
|
|
|
|
|
|
|
Reference:
|
|
|
|
https://packaging.python.org/guides/distributing-packages-using-setuptools/
|
|
|
|
"""
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import pathlib
|
|
|
|
from typing import List, Tuple
|
|
|
|
|
2022-06-14 05:57:01 +03:00
|
|
|
import pkg_resources
|
2021-01-28 16:01:28 +03:00
|
|
|
from setuptools import setup, find_packages, Command
|
|
|
|
|
|
|
|
import superbench
|
|
|
|
|
2022-06-14 05:57:01 +03:00
|
|
|
try:
|
2023-03-06 14:43:44 +03:00
|
|
|
pkg_resources.require(['pip>=18', 'setuptools>=45, <66'])
|
2022-06-14 05:57:01 +03:00
|
|
|
except (pkg_resources.VersionConflict, pkg_resources.DistributionNotFound):
|
2023-03-06 14:43:44 +03:00
|
|
|
print('Try update pip/setuptools versions, for example, python3 -m pip install --upgrade pip setuptools==65.7')
|
2022-06-14 05:57:01 +03:00
|
|
|
raise
|
|
|
|
|
2021-01-28 16:01:28 +03:00
|
|
|
here = pathlib.Path(__file__).parent.resolve()
|
|
|
|
long_description = (here / 'README.md').read_text(encoding='utf-8')
|
|
|
|
|
|
|
|
|
|
|
|
class Formatter(Command):
|
|
|
|
"""Cmdclass for `python setup.py format`.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
Command (distutils.cmd.Command):
|
|
|
|
Abstract base class for defining command classes.
|
|
|
|
"""
|
|
|
|
|
|
|
|
description = 'format the code using yapf'
|
|
|
|
user_options: List[Tuple[str, str, str]] = []
|
|
|
|
|
|
|
|
def initialize_options(self):
|
|
|
|
"""Set default values for options that this command supports."""
|
|
|
|
pass
|
|
|
|
|
|
|
|
def finalize_options(self):
|
|
|
|
"""Set final values for options that this command supports."""
|
|
|
|
pass
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
"""Fromat the code using yapf."""
|
2022-10-31 05:44:41 +03:00
|
|
|
errno = os.system('python3 -m yapf --in-place --recursive --exclude .git --exclude .eggs .')
|
2021-02-01 09:12:02 +03:00
|
|
|
sys.exit(0 if errno == 0 else 1)
|
2021-01-28 16:01:28 +03:00
|
|
|
|
|
|
|
|
|
|
|
class Linter(Command):
|
|
|
|
"""Cmdclass for `python setup.py lint`.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
Command (distutils.cmd.Command):
|
|
|
|
Abstract base class for defining command classes.
|
|
|
|
"""
|
|
|
|
|
|
|
|
description = 'lint the code using flake8'
|
|
|
|
user_options: List[Tuple[str, str, str]] = []
|
|
|
|
|
|
|
|
def initialize_options(self):
|
|
|
|
"""Set default values for options that this command supports."""
|
|
|
|
pass
|
|
|
|
|
|
|
|
def finalize_options(self):
|
|
|
|
"""Set final values for options that this command supports."""
|
|
|
|
pass
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
"""Lint the code with yapf, mypy, and flake8."""
|
2021-02-01 09:12:02 +03:00
|
|
|
errno = os.system(
|
|
|
|
' && '.join(
|
|
|
|
[
|
2022-10-31 05:44:41 +03:00
|
|
|
'python3 -m yapf --diff --recursive --exclude .git --exclude .eggs .',
|
2021-02-01 09:12:02 +03:00
|
|
|
'python3 -m mypy .',
|
|
|
|
'python3 -m flake8',
|
|
|
|
]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
sys.exit(0 if errno == 0 else 1)
|
2021-01-28 16:01:28 +03:00
|
|
|
|
|
|
|
|
|
|
|
class Tester(Command):
|
|
|
|
"""Cmdclass for `python setup.py test`.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
Command (distutils.cmd.Command):
|
|
|
|
Abstract base class for defining command classes.
|
|
|
|
"""
|
|
|
|
|
|
|
|
description = 'test the code using pytest'
|
|
|
|
user_options: List[Tuple[str, str, str]] = []
|
|
|
|
|
|
|
|
def initialize_options(self):
|
|
|
|
"""Set default values for options that this command supports."""
|
|
|
|
pass
|
|
|
|
|
|
|
|
def finalize_options(self):
|
|
|
|
"""Set final values for options that this command supports."""
|
|
|
|
pass
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
"""Run pytest."""
|
2021-02-04 05:43:43 +03:00
|
|
|
errno = os.system('python3 -m pytest -v --cov=superbench --cov-report=xml --cov-report=term-missing tests/')
|
2021-02-01 09:12:02 +03:00
|
|
|
sys.exit(0 if errno == 0 else 1)
|
2021-01-28 16:01:28 +03:00
|
|
|
|
|
|
|
|
|
|
|
setup(
|
|
|
|
name='superbench',
|
|
|
|
version=superbench.__version__,
|
|
|
|
description='Provide hardware and software benchmarks for AI systems.',
|
|
|
|
long_description=long_description,
|
|
|
|
long_description_content_type='text/markdown',
|
|
|
|
url='https://github.com/microsoft/superbenchmark',
|
|
|
|
author=superbench.__author__,
|
|
|
|
author_email='superbench@microsoft.com',
|
|
|
|
license='MIT',
|
|
|
|
classifiers=[
|
|
|
|
'Development Status :: 2 - Pre-Alpha',
|
|
|
|
'Environment :: GPU',
|
|
|
|
'Intended Audience :: System Administrators',
|
|
|
|
'License :: OSI Approved :: MIT License',
|
|
|
|
'Operating System :: POSIX',
|
|
|
|
'Programming Language :: Python :: 3',
|
|
|
|
'Programming Language :: Python :: 3 :: Only',
|
|
|
|
'Programming Language :: Python :: 3.6',
|
|
|
|
'Programming Language :: Python :: 3.7',
|
|
|
|
'Programming Language :: Python :: 3.8',
|
|
|
|
'Programming Language :: Python :: 3.9',
|
|
|
|
'Topic :: System :: Benchmark',
|
|
|
|
'Topic :: System :: Clustering',
|
|
|
|
'Topic :: System :: Hardware',
|
|
|
|
],
|
|
|
|
keywords='benchmark, AI systems',
|
|
|
|
packages=find_packages(exclude=['tests']),
|
|
|
|
python_requires='>=3.6, <4',
|
2022-10-31 05:44:41 +03:00
|
|
|
use_scm_version={
|
|
|
|
'local_scheme': 'node-and-date',
|
|
|
|
'version_scheme': lambda _: superbench.__version__,
|
|
|
|
'fallback_version': f'{superbench.__version__}+unknown',
|
|
|
|
},
|
|
|
|
setup_requires=[
|
|
|
|
'setuptools_scm',
|
|
|
|
],
|
2021-03-12 08:16:43 +03:00
|
|
|
install_requires=[
|
2021-05-23 18:53:37 +03:00
|
|
|
'ansible_base>=2.10.9;os_name=="posix"',
|
2023-03-06 13:54:45 +03:00
|
|
|
'ansible_runner>=2.0.0rc1, <2.3.2',
|
2022-09-06 13:06:05 +03:00
|
|
|
'colorlog>=6.7.0',
|
2022-10-31 05:44:41 +03:00
|
|
|
'importlib_metadata',
|
2021-06-23 13:16:43 +03:00
|
|
|
'jinja2>=2.10.1',
|
2021-06-02 18:58:44 +03:00
|
|
|
'joblib>=1.0.1',
|
2021-12-08 13:22:00 +03:00
|
|
|
'jsonlines>=2.0.0',
|
2021-03-12 08:16:43 +03:00
|
|
|
'knack>=0.7.2',
|
2022-03-15 13:04:11 +03:00
|
|
|
'markdown>=3.3.0',
|
2021-12-10 14:01:59 +03:00
|
|
|
'matplotlib>=3.0.0',
|
Runner: Add Feature - Generate summarized output files. (#157)
**Description**
Generate the summarized output files from all nodes. For each metric, do the reduce operation according to the `reduce_op`
**Major Revision**
- Generate the summarized json file per node:
For microbenchmark, the format is `{benchmark_name}/[{run_count}/]{metric_name}[:rank]`
For modelbenchmark, the format is `{benchmark_name}/{sub_benchmark_name}/[{run_count}/]{metric_name}`
`[]` means optional.
```
{
"kernel-launch/overhead_event:0": 0.00583,
"kernel-launch/overhead_event:1": 0.00545,
"kernel-launch/overhead_event:2": 0.00581,
"kernel-launch/overhead_event:3": 0.00572,
"kernel-launch/overhead_event:4": 0.00559,
"kernel-launch/overhead_event:5": 0.00591,
"kernel-launch/overhead_event:6": 0.00562,
"kernel-launch/overhead_event:7": 0.00586,
"resnet_models/pytorch-resnet50/steptime-train-float32": 544.0827468410134,
"resnet_models/pytorch-resnet50/throughput-train-float32": 353.7607016465773,
"resnet_models/pytorch-resnet50/steptime-train-float16": 425.40482617914677,
"resnet_models/pytorch-resnet50/throughput-train-float16": 454.0142363793973,
"pytorch-sharding-matmul/0/allreduce": 10.561786651611328,
"pytorch-sharding-matmul/1/allreduce": 10.561786651611328,
"pytorch-sharding-matmul/0/allgather": 10.088025093078613,
"pytorch-sharding-matmul/1/allgather": 10.088025093078613
}
```
- Generate the summarized jsonl file for all nodes, each line is the result from one node in json format.
2021-08-20 11:48:40 +03:00
|
|
|
'natsort>=7.1.1',
|
2023-02-17 08:36:21 +03:00
|
|
|
'networkx>=2.5',
|
2022-01-19 05:49:56 +03:00
|
|
|
'numpy>=1.19.2',
|
2021-06-16 08:51:22 +03:00
|
|
|
'omegaconf==2.0.6',
|
2022-08-17 06:33:57 +03:00
|
|
|
'openpyxl>=3.0.7',
|
2023-04-06 10:13:48 +03:00
|
|
|
'pandas>=1.1.5',
|
2022-09-06 13:06:05 +03:00
|
|
|
'pssh @ git+https://github.com/lilydjwg/pssh.git@v2.3.4',
|
2021-06-23 13:16:43 +03:00
|
|
|
'pyyaml>=5.3',
|
2022-08-17 06:33:57 +03:00
|
|
|
'requests>=2.27.1',
|
2021-12-10 14:01:59 +03:00
|
|
|
'seaborn>=0.11.2',
|
2021-10-13 02:42:12 +03:00
|
|
|
'tcping>=0.1.1rc1',
|
2022-07-05 05:52:39 +03:00
|
|
|
'urllib3>=1.26.9',
|
2021-12-08 13:22:00 +03:00
|
|
|
'xlrd>=2.0.1',
|
|
|
|
'xlsxwriter>=1.3.8',
|
2021-09-06 12:48:36 +03:00
|
|
|
'xmltodict>=0.12.0',
|
2021-03-12 08:16:43 +03:00
|
|
|
],
|
2022-08-17 06:33:57 +03:00
|
|
|
extras_require=(
|
|
|
|
lambda x: {
|
|
|
|
**x,
|
|
|
|
'develop': x['dev'] + x['test'],
|
|
|
|
'cpuworker': x['torch'],
|
2022-09-06 13:06:05 +03:00
|
|
|
'amdworker': x['torch'] + x['ort'],
|
|
|
|
'nvworker': x['torch'] + x['ort'] + x['nvidia'],
|
2022-08-17 06:33:57 +03:00
|
|
|
}
|
|
|
|
)(
|
|
|
|
{
|
|
|
|
'dev': ['pre-commit>=2.10.0'],
|
|
|
|
'test': [
|
|
|
|
'flake8-docstrings>=1.5.0',
|
|
|
|
'flake8-quotes>=3.2.0',
|
2022-11-29 07:30:10 +03:00
|
|
|
'flake8>=3.8.4, <6.0.0',
|
2022-08-17 06:33:57 +03:00
|
|
|
'mypy>=0.800',
|
|
|
|
'pydocstyle>=5.1.1',
|
|
|
|
'pytest-cov>=2.11.1',
|
|
|
|
'pytest-subtests>=0.4.0',
|
|
|
|
'pytest>=6.2.2',
|
|
|
|
'types-markdown',
|
|
|
|
'types-pkg_resources',
|
|
|
|
'types-pyyaml',
|
2022-11-17 14:39:52 +03:00
|
|
|
'typing-extensions>=3.10',
|
2022-08-17 06:33:57 +03:00
|
|
|
'vcrpy>=4.1.1',
|
|
|
|
'yapf==0.31.0',
|
|
|
|
],
|
|
|
|
'torch': [
|
|
|
|
'torch>=1.7.0a0',
|
|
|
|
'torchvision>=0.8.0a0',
|
2022-12-14 09:19:32 +03:00
|
|
|
'transformers>=4.3.3, <4.23.0',
|
2022-08-17 06:33:57 +03:00
|
|
|
],
|
|
|
|
'ort': [
|
|
|
|
'onnx>=1.10.2',
|
|
|
|
'onnxruntime-gpu==1.10.0',
|
|
|
|
],
|
|
|
|
'nvidia': ['py3nvml>=0.2.6'],
|
|
|
|
}
|
|
|
|
),
|
2021-03-12 08:16:43 +03:00
|
|
|
include_package_data=True,
|
2021-01-28 16:01:28 +03:00
|
|
|
entry_points={
|
2021-03-12 08:16:43 +03:00
|
|
|
'console_scripts': [
|
|
|
|
'sb = superbench.cli.sb:main',
|
|
|
|
],
|
2021-01-28 16:01:28 +03:00
|
|
|
},
|
|
|
|
cmdclass={
|
|
|
|
'format': Formatter,
|
|
|
|
'lint': Linter,
|
|
|
|
'test': Tester,
|
|
|
|
},
|
2021-02-01 15:21:12 +03:00
|
|
|
project_urls={
|
|
|
|
'Source': 'https://github.com/microsoft/superbenchmark',
|
|
|
|
'Tracker': 'https://github.com/microsoft/superbenchmark/issues',
|
|
|
|
},
|
2021-01-28 16:01:28 +03:00
|
|
|
)
|