8000 Add CUDA_VISIBLE_DEVICES check (#1916) · pytorch/builder@d9e5fef · GitHub
[go: up one dir, main page]

Skip to content

Commit d9e5fef

Browse files
authored
Add CUDA_VISIBLE_DEVICES check (#1916)
1 parent e463b5c commit d9e5fef

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

.github/scripts/validate_binaries.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ else
6969
export PATH=${OLD_PATH}
7070
fi
7171

72+
# Use case CUDA_VISIBLE_DEVICES: https://github.com/pytorch/pytorch/issues/128819
73+
if [[ ${MATRIX_GPU_ARCH_TYPE} == 'cuda' ]]; then
74+
python3 -c "import torch;import os;print(torch.cuda.device_count(), torch.__version__);os.environ['CUDA_VISIBLE_DEVICES']='0';print(torch.empty(2, device='cuda'))"
75+
fi
76+
7277
# this is optional step
7378
if [[ ${TARGET_OS} != linux* ]]; then
7479
conda deactivate

test/smoke_test/smoke_test.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,6 @@ def smoke_test_cuda(package: str, runtime_error_check: str, torch_compile_check:
181181
if (sys.platform in ["linux", "linux2"]):
182182
print(f"torch nccl version: {torch.cuda.nccl.version()}")
183183

184-
185-
# test settind CUDA_VISIBLE_DEVICES
186-
print(f"torch.cuda.device_count: {torch.cuda.device_count()}")
187-
os.environ['CUDA_VISIBLE_DEVICES']='0'
188-
print(torch.empty(2, device='cuda'))
189-
del os.environ['CUDA_VISIBLE_DEVICES']
190-
191184
if runtime_error_check == "enabled":
192185
test_cuda_runtime_errors_captured()
193186

0 commit comments

Comments
 (0)
0