Skip to content

Commit 851fd8a

Browse files
malfetfacebook-github-bot
authored andcommitted
Set torch.set_deterministic to false for GPU tests (#3422)
Summary: Pull Request resolved: #3422 In CUDA-10.1 or below it is a no-op, but few of the tests will start to fail if update to 10.2 or newer, for example: ``` torchvision/transforms/transforms.py", line 1043, in forward transformed_tensor = torch.mm(flat_tensor, self.transformation_matrix) RuntimeError: Deterministic behavior was enabled with either `torch.use_deterministic_algorithms(True)` or `at::Context::setDeterministicAlgorithms(true)`, but this operation is not deterministic because it uses CuBLAS and you have CUDA >= 10.2. To enable deterministic behavior in this case, you must set an environment variable before running your PyTorch application: CUBLAS_WORKSPACE_CONFIG=:4096:8 or CUBLAS_WORKSPACE_CONFIG=:16:8. For more information, go to https://docs.nvidia.com/cuda/cublas/index.html#cublasApi_reproducibility ``` Reviewed By: meyering Differential Revision: D26563045 fbshipit-source-id: 65e5fabc8cdb471a72f931df55389ed7c0063e54
1 parent d1e884d commit 851fd8a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

test/test_transforms_tensor.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ def test_random_autocontrast(self):
114114
self._test_op('autocontrast', 'RandomAutocontrast')
115115

116116
def test_random_equalize(self):
117-
torch.set_deterministic(False)
118117
self._test_op('equalize', 'RandomEqualize')
119118

120119
def test_color_jitter(self):
@@ -480,7 +479,6 @@ def test_linear_transformation(self):
480479
# We skip some tests from _test_transform_vs_scripted_on_batch as
481480
# results for scripted and non-scripted transformations are not exactly the same
482481
torch.manual_seed(12)
483-
torch.set_deterministic(True)
484482
transformed_batch = fn(batch_tensors)
485483
torch.manual_seed(12)
486484
s_transformed_batch = scripted_fn(batch_tensors)
@@ -648,6 +646,7 @@ def test_autoaugment(self):
648646
class CUDATester(Tester):
649647

650648
def setUp(self):
649+
torch.set_deterministic(False)
651650
self.device = "cuda"
652651

653652

0 commit comments

Comments
 (0)