Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
285a7be
Enable unit tests for ROCm builds in CI and exclude the ones that are…
jithunnair-amd Jul 27, 2018
c97c29d
Typo in else condition
jithunnair-amd Jul 27, 2018
5989b32
Install libc++1 and libc++abi1 for ROCm builds so torch._C can load a…
jithunnair-amd Jul 27, 2018
1d33687
Disable test_requires_grad_factory because it errored out in CI with …
jithunnair-amd Jul 30, 2018
5629c8f
Skip more tests in test_autograd.py due to 'Lapack not found' error i…
jithunnair-amd Jul 30, 2018
f04eb89
Disable test_inputbuffer_add_multigpu for ROCm since multi-gpu not su…
jithunnair-amd Jul 31, 2018
ad7b044
Disable test_type_conversions for ROCm due to Memory access fault in …
jithunnair-amd Jul 31, 2018
d61bf6e
Skip test_unused_output_gpu in ROCm because of Memory access fault
jithunnair-amd Jul 31, 2018
e7c704f
Disable all other test groups except test_autograd for ROCm for now
jithunnair-amd Jul 31, 2018
127b3d3
Disable test_aten for rocm builds since aten install step is not run …
jithunnair-amd Aug 1, 2018
14aa7e3
Merge branch 'master' into enable_unit_tests_for_rocm
iotamudelta Aug 2, 2018
7fe07a0
Merge branch 'master' into enable_unit_tests_for_rocm
jithunnair-amd Aug 2, 2018
6df9165
Use repr(e) instead of e.args[0] to consistently skip if no lapack. O…
jithunnair-amd Aug 2, 2018
ca881f7
Merge branch 'enable_unit_tests_for_rocm' of https://github.com/jithu…
jithunnair-amd Aug 2, 2018
f5e7501
Merge branch 'master' into enable_unit_tests_for_rocm
jithunnair-amd Aug 3, 2018
1a4d5da
Install mkl for ROCm builds as well so that lapack tests are not skipped
jithunnair-amd Aug 3, 2018
39eae9b
Use --user option to install pip package without permission error
jithunnair-amd Aug 3, 2018
b9fda9f
I give up. Reverting attempts to install mkl and proceeding to disabl…
jithunnair-amd Aug 3, 2018
7496d91
Disable test_potrf for ROCm builds since it doesn't skip due to no la…
jithunnair-amd Aug 3, 2018
714d7fd
Use --user to avoid permission error
jithunnair-amd Aug 4, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .jenkins/pytorch/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ if [[ "$BUILD_ENVIRONMENT" == *rocm* ]]; then
# This environment variable enabled HCC Optimizations that speed up the linking stage.
# https://github.com/RadeonOpenCompute/hcc#hcc-with-thinlto-linking
export KMTHINLTO=1

# Need the libc++1 and libc++abi1 libraries to allow torch._C to load at runtime
sudo apt-get install libc++1
sudo apt-get install libc++abi1

python tools/amd_build/build_pytorch_amd.py
USE_ROCM=1 python setup.py install --user
exit 0
Expand Down
2 changes: 0 additions & 2 deletions .jenkins/pytorch/disabled-configs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
# fail. You can use this to temporarily reserve a test name to
# turn on CI side before PyTorch repository supports it. This
# file has the same format as .jenkins/enabled-configs.txt

py2-clang3.8-rocm1.7.1-ubuntu16.04-test
1 change: 1 addition & 0 deletions .jenkins/pytorch/enabled-configs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ pytorch-docker-build-test
short-perf-test-cpu
short-perf-test-gpu
py2-clang3.8-rocm1.7.1-ubuntu16.04-build
py2-clang3.8-rocm1.7.1-ubuntu16.04-test
4 changes: 2 additions & 2 deletions .jenkins/pytorch/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ test_python_all_except_nn() {

test_aten() {
# Test ATen
if [[ "$BUILD_ENVIRONMENT" != *asan* ]]; then
if ([[ "$BUILD_ENVIRONMENT" != *asan* ]] && [[ "$BUILD_ENVIRONMENT" != *rocm* ]]); then
echo "Running ATen tests with pytorch lib"
TORCH_LIB_PATH=$(python -c "import site; print(site.getsitepackages()[0])")/torch/lib
# NB: the ATen test binaries don't have RPATH set, so it's necessary to
Expand All @@ -101,7 +101,7 @@ test_torchvision() {
# this should be a transient requirement...)
# See https://github.com/pytorch/pytorch/issues/7525
#time python setup.py install
pip install .
pip install --user .
popd
}

Expand Down
10 changes: 9 additions & 1 deletion test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,22 @@ def _check_module_exists(name):
if TEST_NUMPY:
import numpy

def skipIfRocm(fn):
@wraps(fn)
def wrapper(*args, **kwargs):
if TEST_WITH_ROCM:
raise unittest.SkipTest("test doesn't currently work on the ROCm stack")
else:
fn(*args, **kwargs)
return wrapper

def skipIfNoLapack(fn):
@wraps(fn)
def wrapper(*args, **kwargs):
try:
fn(*args, **kwargs)
except Exception as e:
if 'Lapack library not found' in e.args[0]:
if 'Lapack library not found' in repr(e):
raise unittest.SkipTest('Compiled without Lapack')
raise
return wrapper
Expand Down
23 changes: 23 additions & 0 deletions test/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import torch
from torch.utils import cpp_extension
from common import TEST_WITH_ROCM

TESTS = [
'autograd',
Expand All @@ -38,6 +39,25 @@
'distributed',
]

ROCM_BLACKLIST = [
'c10d',
'cpp_extensions',
'cuda',
'dataloader',
'distributed',
'distributions',
'indexing',
'jit',
'legacy_nn',
'multiprocessing',
'nccl',
'nn',
'optim',
'sparse',
'torch',
'utils',
]

DISTRIBUTED_TESTS_CONFIG = {
'tcp': {
'WORLD_SIZE': '3'
Expand Down Expand Up @@ -303,6 +323,9 @@ def get_selected_tests(options):

selected_tests = exclude_tests(WINDOWS_BLACKLIST, selected_tests, 'on Windows')

elif TEST_WITH_ROCM:
selected_tests = exclude_tests(ROCM_BLACKLIST, selected_tests, 'on ROCm')

return selected_tests


Expand Down
17 changes: 12 additions & 5 deletions test/test_autograd.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from torch.autograd.function import once_differentiable
from torch.autograd.profiler import profile
from common import TEST_MKL, TestCase, run_tests, skipIfNoLapack, \
suppress_warnings, TEST_WITH_ROCM
suppress_warnings, TEST_WITH_ROCM, skipIfRocm
from torch.autograd import Variable, Function, detect_anomaly
from torch.autograd.function import InplaceFunction
from torch.testing import make_non_contiguous, randn_like
Expand Down Expand Up @@ -975,6 +975,7 @@ def test_no_requires_grad_inplace(self):
with self.assertRaises(RuntimeError):
b.add_(5)

@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
def test_requires_grad_factory(self):
x = torch.randn(2, 3)
fns = [torch.ones_like, torch.testing.randn_like]
Expand Down Expand Up @@ -1374,6 +1375,7 @@ def __del__(self):
Variable(torch.randn(10, 10), _grad_fn=CollectOnDelete())

@unittest.skipIf(torch.cuda.device_count() < 2, "no multi-GPU")
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
def test_unused_output_gpu(self):
from torch.nn.parallel._functions import Broadcast
x = Variable(torch.randn(5, 5).float().cuda(), requires_grad=True)
Expand Down Expand Up @@ -1402,6 +1404,7 @@ def backward(ctx, grad_output):
self.assertEqual(device[0], 1)

@unittest.skipIf(torch.cuda.device_count() < 2, "no multi-GPU")
@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
def test_inputbuffer_add_multigpu(self):
input = torch.randn(1).cuda(0).requires_grad_()
output = input.cuda(1) + input.cuda(1)
Expand Down Expand Up @@ -1451,6 +1454,7 @@ def test_detach_base(self):
self.assertIsNotNone(view.grad_fn)
self.assertIs(view._base, x)

@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
def _test_type_conversion_backward(self, t, ):
fvar = Variable(t(torch.randn(5, 5).float()), requires_grad=True)
fvar.double().sum().backward()
Expand Down Expand Up @@ -1910,6 +1914,7 @@ def test_cat_empty(self):
lambda a, b: torch.cat((a, b)),
True, f_args_variable, f_args_tensor)

@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
def test_potrf(self):
root = Variable(torch.tril(torch.rand(S, S)), requires_grad=True)

Expand Down Expand Up @@ -2069,6 +2074,7 @@ def run_test(input_size, exponent):
run_test((10, 10), torch.zeros(10, 10))
run_test((10,), 0)

@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
def test_pinverse(self):
# Why is pinverse tested this way, and not ordinarily as other linear algebra methods?
# 1. Pseudo-inverses are not generally continuous, which means that they are not differentiable
Expand Down Expand Up @@ -2451,6 +2457,7 @@ def backward(ctx, gO):
out.backward()
self.assertIn('MyFunc.apply', str(w[0].message))

@unittest.skipIf(TEST_WITH_ROCM, "test doesn't currently work on the ROCm stack")
def test_symeig_no_eigenvectors(self):
A = torch.tensor([[1., 2.], [2., 4.]], dtype=torch.float32, requires_grad=True)
w, v = torch.symeig(A, eigenvectors=False)
Expand Down Expand Up @@ -3080,10 +3087,10 @@ class dont_convert(tuple):
('svd', lambda: random_fullrank_matrix_distinct_singular_value(M), NO_ARGS,
'large', NO_ARGS, [skipIfNoLapack]),
('gesv', (S, S), ((S, S),), '', NO_ARGS, [skipIfNoLapack]),
('gesv', (S, S, S), ((S, S, S),), 'batched', NO_ARGS, [skipIfNoLapack]),
('gesv', (2, 3, S, S), ((2, 3, S, S),), 'batched_dims', NO_ARGS, [skipIfNoLapack]),
('gesv', (2, 2, S, S), ((1, S, S),), 'batched_broadcast_A', NO_ARGS, [skipIfNoLapack]),
('gesv', (1, S, S), ((2, 2, S, S),), 'batched_broadcast_b', NO_ARGS, [skipIfNoLapack]),
('gesv', (S, S, S), ((S, S, S),), 'batched', NO_ARGS, [skipIfNoLapack, skipIfRocm]),
('gesv', (2, 3, S, S), ((2, 3, S, S),), 'batched_dims', NO_ARGS, [skipIfNoLapack, skipIfRocm]),
('gesv', (2, 2, S, S), ((1, S, S),), 'batched_broadcast_A', NO_ARGS, [skipIfNoLapack, skipIfRocm]),
('gesv', (1, S, S), ((2, 2, S, S),), 'batched_broadcast_b', NO_ARGS, [skipIfNoLapack, skipIfRocm]),
('fill_', (S, S, S), (1,), 'number'),
('fill_', (), (1,), 'number_scalar'),
# FIXME: we should compute the derivative w.r.t torch.tensor(1)
Expand Down