Unverified Commit 331c740a authored by guoshzhao's avatar guoshzhao Committed by GitHub
Browse files

Benchmarks: Add Feature - Add nvml package to provide python interfaces of nvidia. (#91)

parent 83235433
......@@ -16,7 +16,7 @@ steps:
echo "##vso[task.prependpath]$HOME/.local/bin"
displayName: Export path
- script: |
python3 -m pip install .[test,torch]
python3 -m pip install .[test,nvidia,torch]
make postinstall
displayName: Install dependencies
- script: |
......
......@@ -88,6 +88,6 @@ WORKDIR ${SB_HOME}
ADD . .
RUN cd ${SB_HOME} && \
python3 -m pip install .[torch] && \
python3 -m pip install .[nvidia,torch] && \
make cppbuild && \
make thirdparty
make thirdparty
\ No newline at end of file
......@@ -158,6 +158,7 @@ def run(self):
'torchvision>=0.8.0',
'transformers>=4.3.3',
],
'nvidia': ['py3nvml>=0.2.6']
},
include_package_data=True,
entry_points={
......
......@@ -7,4 +7,6 @@
from superbench.common.utils.file_handler import create_output_dir, get_sb_config
from superbench.common.utils.lazy_import import LazyImport
__all__ = ['SuperBenchLogger', 'logger', 'create_output_dir', 'get_sb_config', 'LazyImport']
nv_helper = LazyImport('superbench.common.utils.nvidia_helper')
__all__ = ['SuperBenchLogger', 'logger', 'create_output_dir', 'get_sb_config', 'LazyImport', 'nv_helper']
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Nvidia Utility."""
import py3nvml.py3nvml as nvml
def get_device_compute_capability():
"""Get the compute capability of device.
Return:
cap (float): the compute capability of device, None means no device found.
"""
nvml.nvmlInit()
device_count = nvml.nvmlDeviceGetCount()
if device_count == 0:
return None
handle = nvml.nvmlDeviceGetHandleByIndex(0)
cap = nvml.nvmlDeviceGetCudaComputeCapability(handle)
return cap
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment