Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
apex
Commits
a73d7d3b
Commit
a73d7d3b
authored
May 19, 2020
by
lcskrishna
Browse files
create a base framework for adding tests
parent
65490af6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
tests/L0/common_utils.py
tests/L0/common_utils.py
+17
-0
tests/L0/run_test.py
tests/L0/run_test.py
+14
-0
No files found.
tests/L0/common_utils.py
0 → 100644
View file @
a73d7d3b
'''
This file contains common utility functions for running the unit tests on ROCM.
'''
import
torch
TEST_WITH_ROCM
=
os
.
getenv
(
'APEX_TEST_WITH_ROCM'
,
'0'
)
==
'1'
## Wrapper to skip the unit tests.
def
skipIfRocm
(
fn
):
@
wraps
(
fn
)
def
wrapper
(
*
args
,
**
kwargs
):
if
TEST_WITH_ROCM
:
raise
unittest
.
SkipTest
(
"test doesn't currently work on ROCm stack."
)
else
:
fn
(
*
args
,
**
kwargs
)
return
wrapper
tests/L0/run_test.py
View file @
a73d7d3b
import
unittest
import
sys
from
common_utils
import
*
test_dirs
=
[
"run_amp"
,
"run_fp16util"
,
"run_optimizers"
,
"run_fused_layer_norm"
,
"run_pyprof_nvtx"
,
"run_pyprof_data"
,
"run_mlp"
]
ROCM_BLACKLIST
=
[
'run_amp'
,
'run_fp16util'
,
'run_optimizers'
,
'run_fused_layer_norm'
,
'run_pyprof_nvtx'
,
'run_pyprof_data'
,
'run_mlp'
]
runner
=
unittest
.
TextTestRunner
(
verbosity
=
2
)
errcode
=
0
for
test_dir
in
test_dirs
:
if
test_dir
in
ROCM_BLACKLIST
:
continue
suite
=
unittest
.
TestLoader
().
discover
(
test_dir
)
print
(
"
\n
Executing tests from "
+
test_dir
)
...
...
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