File tree 5 files changed +9
-20
lines changed
5 files changed +9
-20
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,10 @@ jobs:
26
26
27
27
- name : Install docs dependencies
28
28
run : |
29
- pip install -vv .
29
+ pip install -vv . --no-deps
30
30
pip install -r docs/requirements.txt
31
31
env :
32
- WITH_CUDA : " 0 "
32
+ ACCELERATOR : " cpu "
33
33
34
34
- name : Build Sphinx Documentation
35
35
run : |
Original file line number Diff line number Diff line change @@ -59,15 +59,13 @@ jobs:
59
59
env :
60
60
ACCELERATOR : ${{ matrix.accelerator }}
61
61
CPU_TRAIN : ${{ runner.os == 'macOS' && 'true' || 'false' }}
62
- WITH_CUDA : ${{ matrix.accelerator != 'cpu' && '1' || '0' }}
63
62
64
63
- name : Build wheels
65
64
if : matrix.os == 'windows-2019'
66
65
shell : cmd # Use cmd on Windows to avoid bash environment taking priority over MSVC variables
67
66
run : python -m cibuildwheel --output-dir wheelhouse
68
67
env :
69
68
ACCELERATOR : ${{ matrix.accelerator }}
70
- WITH_CUDA : ${{ matrix.accelerator != 'cpu' && '1' || '0' }}
71
69
DISTUTILS_USE_SDK : " 1" # Windows requires this to use vc for building
72
70
SKIP_TORCH_COMPILE : " true"
73
71
Original file line number Diff line number Diff line change 73
73
python -m build
74
74
pip install dist/*.whl
75
75
env :
76
- WITH_CUDA : " 0 "
76
+ ACCELERATOR : " cpu "
77
77
78
78
# - name: Install nnpops
79
79
# if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
85
85
- name : Run tests
86
86
run : pytest -v -s --durations=10
87
87
env :
88
- WITH_CUDA : " 0 "
88
+ ACCELERATOR : " cpu "
89
89
SKIP_TORCH_COMPILE : ${{ runner.os == 'Windows' && 'true' || 'false' }}
90
90
OMP_PREFIX : ${{ runner.os == 'macOS' && '/Users/runner/miniconda3/envs/test' || '' }}
91
91
CPU_TRAIN : ${{ runner.os == 'macOS' && 'true' || 'false' }}
Original file line number Diff line number Diff line change @@ -30,8 +30,6 @@ if [ "$ACCELERATOR" == "cu118" ]; then
30
30
ln -s /opt/rh/gcc-toolset-11/root/usr/bin/g++ /usr/local/cuda/bin/g++
31
31
32
32
export CUDA_HOME=" /usr/local/cuda"
33
- export WITH_CUDA=1
34
-
35
33
36
34
# Configure pip to use PyTorch extra-index-url for CUDA 11.8
37
35
mkdir -p $HOME /.config/pip
Original file line number Diff line number Diff line change 9
9
import platform
10
10
11
11
12
- # If WITH_CUDA is defined
13
- env_with_cuda = os .getenv ("WITH_CUDA" )
14
- if env_with_cuda is not None :
15
- if env_with_cuda not in ("0" , "1" ):
16
- raise ValueError (
17
- f"WITH_CUDA environment variable got invalid value { env_with_cuda } . Expected '0' or '1'"
18
- )
19
- use_cuda = env_with_cuda == "1"
20
- else :
21
- use_cuda = torch .cuda ._is_compiled ()
12
+ use_cuda = (
13
+ os .environ .get ("ACCELERATOR" , "" ).startswith ("cu" ) or torch .cuda ._is_compiled ()
14
+ )
22
15
23
16
24
17
def set_torch_cuda_arch_list ():
@@ -56,8 +49,8 @@ def set_torch_cuda_arch_list():
56
49
]
57
50
58
51
extra_deps = []
59
- if use_cuda :
60
- cuda_ver = os .getenv ("ACCELERATOR" , "" )[2 :4 ]
52
+ if os . getenv ( "ACCELERATOR" , "" ). startswith ( "cu" ) :
53
+ cuda_ver = os .getenv ("ACCELERATOR" )[2 :4 ]
61
54
extra_deps = [f"nvidia-cuda-runtime-cu{ cuda_ver } " ]
62
55
63
56
ExtensionType = CppExtension if not use_cuda else CUDAExtension
You can’t perform that action at this time.
0 commit comments