Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
superbenchmark
Commits
331c740a
Unverified
Commit
331c740a
authored
Jun 01, 2021
by
guoshzhao
Committed by
GitHub
Jun 01, 2021
Browse files
Benchmarks: Add Feature - Add nvml package to provide python interfaces of nvidia. (#91)
parent
83235433
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
4 deletions
+29
-4
.azure-pipelines/cuda-unit-test.yml
.azure-pipelines/cuda-unit-test.yml
+1
-1
dockerfile/cuda11.1.1.dockerfile
dockerfile/cuda11.1.1.dockerfile
+2
-2
setup.py
setup.py
+1
-0
superbench/common/utils/__init__.py
superbench/common/utils/__init__.py
+3
-1
superbench/common/utils/nvidia_helper.py
superbench/common/utils/nvidia_helper.py
+22
-0
No files found.
.azure-pipelines/cuda-unit-test.yml
View file @
331c740a
...
...
@@ -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
:
|
...
...
dockerfile/cuda11.1.1.dockerfile
View file @
331c740a
...
...
@@ -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
setup.py
View file @
331c740a
...
...
@@ -158,6 +158,7 @@ setup(
'torchvision>=0.8.0'
,
'transformers>=4.3.3'
,
],
'nvidia'
:
[
'py3nvml>=0.2.6'
]
},
include_package_data
=
True
,
entry_points
=
{
...
...
superbench/common/utils/__init__.py
View file @
331c740a
...
...
@@ -7,4 +7,6 @@ from superbench.common.utils.logging import SuperBenchLogger, logger
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'
]
superbench/common/utils/nvidia_helper.py
0 → 100644
View file @
331c740a
# 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment