File size: 391 Bytes
e5235fb
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
"""CPU test suite: hide the GPUs unless GPU tests were asked for (-m gpu). The GPUs run queued jobs, and some
PyTorch paths (AdamW's graph-capture check) touch CUDA even for CPU tensors."""
import os


def pytest_configure(config):
    markexpr = config.getoption("-m") or ""
    if "gpu" in markexpr and "not gpu" not in markexpr:
        return
    os.environ["CUDA_VISIBLE_DEVICES"] = ""