Allow CUDA and IPU tests without the CI environment var (#13676)

This commit is contained in:
Carlos Mocholí 2022-07-19 06:40:25 +02:00 committed by GitHub
parent 35ec79ad1f
commit 0e5a51f55c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -127,8 +127,7 @@ class RunIf:
reasons = []
if min_cuda_gpus:
env_flag = os.getenv("PL_RUN_CUDA_TESTS", "0")
conditions.append(env_flag != "1" or torch.cuda.device_count() < min_cuda_gpus)
conditions.append(torch.cuda.device_count() < min_cuda_gpus)
reasons.append(f"GPUs>={min_cuda_gpus}")
# used in conftest.py::pytest_collection_modifyitems
kwargs["min_cuda_gpus"] = True
@ -180,8 +179,7 @@ class RunIf:
reasons.append("TPU")
if ipu:
env_flag = os.getenv("PL_RUN_IPU_TESTS", "0")
conditions.append(env_flag != "1" or not _IPU_AVAILABLE)
conditions.append(not _IPU_AVAILABLE)
reasons.append("IPU")
# used in conftest.py::pytest_collection_modifyitems
kwargs["ipu"] = True

View File

@ -101,7 +101,7 @@ report+="Ran\tplugins/environments/torch_elastic_deadlock.py\n"
# test that a user can manually launch individual processes
export PYTHONPATH="${PYTHONPATH}:$(pwd)"
args="--trainer.gpus 2 --trainer.strategy ddp --trainer.max_epochs=1 --trainer.limit_train_batches=1 --trainer.limit_val_batches=1 --trainer.limit_test_batches=1"
args="--trainer.accelerator gpu --trainer.devices 2 --trainer.strategy ddp --trainer.max_epochs=1 --trainer.limit_train_batches=1 --trainer.limit_val_batches=1 --trainer.limit_test_batches=1"
MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=1 python ../../examples/convert_from_pt_to_pl/image_classifier_5_lightning_datamodule.py ${args} &
MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=0 python ../../examples/convert_from_pt_to_pl/image_classifier_5_lightning_datamodule.py ${args}
report+="Ran\tmanual ddp launch test\n"