-
Notifications
You must be signed in to change notification settings - Fork 14
112 lines (101 loc) · 4.03 KB
/
manual-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: nitorch-manual-build
on:
workflow_dispatch:
inputs:
os:
description: 'Operating system'
required: false
default: 'ubuntu-18.04'
python-version:
description: 'Version of python'
required: false
default: '3.6'
pytorch-version:
description: 'Version of pytorch'
required: false
default: '1.6'
cuda-version:
description: 'Version of cuda'
required: false
default: '10.1'
compiled-backend:
description: 'Compiled backend'
required: false
default: 'TS'
jobs:
build:
runs-on: ${{ github.event.inputs.os }}
steps:
- uses: actions/checkout@v2
- if: runner.os == 'Windows' && github.event.inputs.compiled-backend == 'C'
# Windows -> powershell
name: Install CUDA ${{ github.event.inputs.cuda-version }} (Windows)
env:
cuda: ${{ github.event.inputs.cuda-version }}
shell: powershell
run: |
# Install CUDA via a powershell script
.\scripts\actions\install_cuda_windows.ps1
if ($?) {
# Set paths for subsequent steps, using $env:CUDA_PATH
echo "Adding CUDA to CUDA_PATH, CUDA_PATH_X_Y and PATH"
echo "CUDA_PATH=$env:CUDA_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "$env:CUDA_PATH_VX_Y=$env:CUDA_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "$env:CUDA_PATH/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
}
- if: runner.os != 'Windows' && github.event.inputs.compiled-backend == 'C'
# Unix -> bash
name: Install CUDA ${{ github.event.inputs.cuda-version }} (Unix)
env:
cuda: ${{ github.event.inputs.cuda-version }}
shell: bash
run: |
if [ ! -z ${{ github.event.inputs.cuda-version }} ]; then
os="$(cut -d'-' -f1 <<< ${{ github.event.inputs.os }})"
echo "$os"
if [ ! -f "./scripts/actions/install_cuda_${os}.sh" ]; then
echo "cuda not available on ${os}"
exit 1
fi
source "./scripts/actions/install_cuda_${os}.sh"
if [[ $? -eq 0 ]]; then
# Set paths for subsequent steps, using ${CUDA_PATH}
echo "Adding CUDA to CUDA_PATH, PATH and LD_LIBRARY_PATH"
echo "CUDA_PATH=${CUDA_PATH}" >> $GITHUB_ENV
echo "${CUDA_PATH}/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
fi
fi
- name: Set up Python ${{ github.event.inputs.python-version }} on ${{ github.event.inputs.os }}
uses: actions/setup-python@v2
with:
python-version: ${{ github.event.inputs.python-version }}
- name: Install pip
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install PyTorch ${{ github.event.inputs.pytorch-version }}
env:
cuda: ${{ github.event.inputs.cuda-version }}
torch: ${{ github.event.inputs.pytorch-version }}
shell: bash
run: |
os="$(cut -d'-' -f1 <<< ${{ github.event.inputs.os }})"
echo "$os"
if [ ! -f "./scripts/actions/install_pytorch_${os}.sh" ]; then
echo "pytorch not available on ${os}"
exit 1
fi
source "./scripts/actions/install_pytorch_${os}.sh"
- name: Build nitorch
# Compiling for all architectures takes ages and this workflow is just
# here to test that we didn't break anything in the compilation chain
# so we only test one architecture (sm_35 -> the default)
# In the package distribution workflow, we'll need to compile for
# all architectures supported by (the pypi version of) pytorch.
run: |
# install scipy ourselves because setuptools does a poor job
pip install scipy
NI_COMPILED_BACKEND=${{ github.event.inputs.compiled-backend }} \
TORCH_CUDA_ARCH_LIST="3.5" \
python setup.py install