Skip to content

Set torch.set_deterministic to false for GPU tests #3422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

malfet
Copy link
Contributor

@malfet malfet commented Feb 20, 2021

Summary:
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

@facebook-github-bot
Copy link

This pull request was exported from Phabricator. Differential Revision: D26563045

@malfet malfet force-pushed the export-D26563045-to-fbsync branch from cac5081 to 3ef8a50 Compare February 20, 2021 02:27
Summary:
Pull Request resolved: pytorch#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: 255c234d3d179f1b623c6c61ba2b1b9637417494
@facebook-github-bot
Copy link

This pull request was exported from Phabricator. Differential Revision: D26563045

@malfet malfet force-pushed the export-D26563045-to-fbsync branch from 3ef8a50 to 7e6698e Compare February 20, 2021 02:31
@codecov
Copy link

codecov bot commented Feb 20, 2021

Codecov Report

Merging #3422 (7e6698e) into fbsync (6ddda3a) will increase coverage by 9.15%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           fbsync    #3422      +/-   ##
==========================================
+ Coverage   65.65%   74.80%   +9.15%     
==========================================
  Files          74      105      +31     
  Lines        5786     9714    +3928     
  Branches      884     1561     +677     
==========================================
+ Hits         3799     7267    +3468     
- Misses       1723     1960     +237     
- Partials      264      487     +223     
Impacted Files Coverage Δ
torchvision/__init__.py 63.88% <ø> (-6.70%) ⬇️
torchvision/datasets/video_utils.py 69.27% <0.00%> (-14.80%) ⬇️
torchvision/models/detection/backbone_utils.py 88.05% <0.00%> (-11.95%) ⬇️
torchvision/io/__init__.py 89.65% <0.00%> (-10.35%) ⬇️
torchvision/datasets/imagenet.py 82.60% <0.00%> (-8.31%) ⬇️
torchvision/ops/boxes.py 87.05% <0.00%> (-7.68%) ⬇️
torchvision/ops/poolers.py 86.53% <0.00%> (-7.50%) ⬇️
torchvision/models/mnasnet.py 75.75% <0.00%> (-6.96%) ⬇️
torchvision/utils.py 59.57% <0.00%> (-5.82%) ⬇️
... and 93 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d1e884d...7e6698e. Read the comment docs.

facebook-github-bot pushed a commit that referenced this pull request Feb 20, 2021
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
@fmassa
Copy link
Member

fmassa commented Feb 22, 2021

Merged in 851fd8a

@fmassa fmassa closed this Feb 22, 2021
fmassa pushed a commit to fmassa/vision-1 that referenced this pull request Feb 23, 2021
Summary:
Pull Request resolved: pytorch#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
fmassa added a commit that referenced this pull request Feb 23, 2021
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

Co-authored-by: Nikita Shulga <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants