mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
* remove legacy options from CMakeLists * codemod WITH_ to USE_ for WITH_CUDA, WITH_CUDNN, WITH_DISTRIBUTED, WITH_DISTRIBUTED_MW, WITH_GLOO_IBVERBS, WITH_NCCL, WITH_ROCM, WITH_NUMPY * cover SYSTEM_NCCL, MKLDNN, NNPACK, C10D, NINJA * removed NO_* variables and hotpatch them only in setup.py * fix lint
26 lines
732 B
Python
26 lines
732 B
Python
import os
|
|
import platform
|
|
import sys
|
|
from itertools import chain
|
|
|
|
|
|
IS_WINDOWS = (platform.system() == 'Windows')
|
|
IS_DARWIN = (platform.system() == 'Darwin')
|
|
IS_LINUX = (platform.system() == 'Linux')
|
|
|
|
|
|
IS_CONDA = 'conda' in sys.version or 'Continuum' in sys.version or any([x.startswith('CONDA') for x in os.environ])
|
|
CONDA_DIR = os.path.join(os.path.dirname(sys.executable), '..')
|
|
|
|
|
|
def check_env_flag(name, default=''):
|
|
return os.getenv(name, default).upper() in ['ON', '1', 'YES', 'TRUE', 'Y']
|
|
|
|
|
|
def check_negative_env_flag(name, default=''):
|
|
return os.getenv(name, default).upper() in ['OFF', '0', 'NO', 'FALSE', 'N']
|
|
|
|
|
|
def gather_paths(env_vars):
|
|
return list(chain(*(os.getenv(v, '').split(':') for v in env_vars)))
|