forked from mlverse/torch
-
Notifications
You must be signed in to change notification settings - Fork 0
259 lines (252 loc) · 9.55 KB
/
main.yaml
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
on:
push:
branches:
- master
- main
pull_request:
schedule:
- cron: "0 1 * * *"
workflow_dispatch:
name: Test
jobs:
check:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-20.04", "macos-latest", "windows-latest"]
r_version: ["release"]
include:
- os: ubuntu-20.04
cran: https://demo.rstudiopm.com/all/__linux__/focal/latest
install: 0
r_version: "release"
- os: ubuntu-20.04
install: 1
r_version: "4.1"
precxxx11abi: 1
container: "rstudio/r-base:4.2-centos7"
cran: https://packagemanager.rstudio.com/all/__linux__/centos7/latest
- os: ubuntu-20.04
cran: https://demo.rstudiopm.com/all/__linux__/focal/latest
install: 1
r_version: "4.0"
- os: macos-latest
install: 1
r_version: "release"
- os: windows-latest
install: 1
r_version: "release"
- os: windows-latest
install: 1
r_version: "3.6"
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
name: ${{ matrix.os }} (${{ matrix.r_version }})
timeout-minutes: 120
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
INSTALL_TORCH: ${{ matrix.install }}
CRAN: ${{ matrix.cran }}
TORCH_LOG: 2
TORCH_TEST: 1
TORCH_INSTALL: 1
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
PRECXX11ABI: ${{ matrix.precxxx11abi }}
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-r@v2
if: matrix.container == ''
with:
r-version: ${{ matrix.r_version }}
- uses: r-lib/actions/setup-pandoc@v2
if: matrix.container == ''
- name: Set CRAN mirror
if: contains(matrix.container, 'centos')
run: |
echo "options(repos = c(CRAN = 'https://cran.rstudio.com'))" > .Rprofile
sudo yum install -y openssl-devel
wget https://github.com/Kitware/CMake/releases/download/v3.24.1/cmake-3.24.1-linux-x86_64.sh
chmod u+x cmake-3.24.1-linux-x86_64.sh
./cmake-3.24.1-linux-x86_64.sh --skip-license --prefix=/usr/local
- name: Install system dependencies
if: runner.os == 'Linux' && matrix.container == ''
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "install.packages(c('remotes'))" -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
- name: Install dependencies
run: Rscript -e "install.packages(c('remotes', 'rcmdcheck'))" -e "remotes::install_deps(dependencies = TRUE)"
- name: Print R session information
run: |
if (utils::packageVersion("sessioninfo") >= "1.2.1") {
sessioninfo::session_info(pkgs = "installed", include_base = TRUE)
} else {
options(width = 200)
sessioninfo::session_info(rownames(installed.packages()), include_base = TRUE)
}
shell: Rscript {0}
- name: Build lantern and get libtorch
if: matrix.install == 0 || contains( github.event.pull_request.labels.*.name, 'lantern')
run: |
Rscript tools/buildlantern.R
- name: Check
run: |
error_on <- if (.Platform$OS.type == "windows") "error" else "warning"
rcmdcheck::rcmdcheck(args = c("--no-multiarch", "--no-manual"), error_on = error_on, check_dir = "check")
shell: Rscript {0}
- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
- name: Logs
if: ${{ failure() }}
run: if [ -f lantern.log ]; then cat lantern.log; fi
shell: bash
gpu:
strategy:
fail-fast: false
matrix:
cuda: ["102", "113"]
runs-on: [self-hosted, linux]
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
CRAN: https://demo.rstudiopm.com/all/__linux__/bionic/latest
DOCKER_FILE: ${{ format('docker/cuda-{0}', matrix.cuda) }}
DOCKER_TAG: ${{ format('torch{0}', matrix.cuda) }}
TORCH_TEST: 1
TORCH_INSTALL: 1
BUILD_LANTERN: ${{ contains( github.event.pull_request.labels.*.name, 'lantern') }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
DEBIAN_FRONTEND: "noninteractive"
steps:
- uses: actions/checkout@v3
- name: Build image
run: docker build -f $DOCKER_FILE -t $DOCKER_TAG .
- name: Run checks
run: docker run --rm --gpus all -e BUILD_LANTERN $DOCKER_TAG sh torch/tools/check.sh
# start-runner:
# runs-on: ubuntu-20.04
# if: ${{ github.ref == 'refs/heads/main' || contains( github.event.pull_request.labels.*.name, 'win-gpu') }}
# steps:
# - name: Set up Cloud SDK
# uses: google-github-actions/setup-gcloud@v0
# with:
# project_id: ${{ secrets.GCP_PROJECT_ID }}
# service_account_key: ${{ secrets.GCP_APPLICATION_CREDENTIALS }}
# export_default_credentials: true
# - name: Create registration token
# uses: actions/github-script@v3
# id: token
# with:
# github-token: ${{secrets.GH_TOKEN}}
# result-encoding: string
# script: |
# const result = await github.actions.createRegistrationTokenForRepo({
# owner: 'mlverse',
# repo: 'torch'
# });
# console.log(result)
# return result.data.token
# - name: Create the startup script
# run: |
# touch s.ps
# echo "mkdir C:\actions-runner; cd C:\actions-runner" >> s.ps
# echo "Invoke-WebRequest -Uri https://github.com/actions/runner/releases/download/v2.277.1/actions-runner-win-x64-2.277.1.zip -OutFile actions-runner-win-x64-2.277.1.zip" >> s.ps
# echo 'Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/actions-runner-win-x64-2.277.1.zip", "$PWD")' >> s.ps
# echo "./config.cmd --url https://github.com/mlverse/torch --token ${{ steps.token.outputs.result }} --name 'runner-${{ github.run_number }}' --labels 'run-${{ github.run_number}}' --unattended" >> s.ps
# echo 'Start-Process -FilePath "./run.cmd"' >> s.ps
#
# - name: Show File
# run: |
# cat s.ps
# - name: Create instance
# run: |
# gcloud components install beta --quiet
# gcloud beta compute --project=rstudio-cloudml instances create runner-${{github.run_number}} \
# --zone=us-central1-a \
# --machine-type=n1-standard-8 \
# --accelerator=type=nvidia-tesla-k80,count=1 \
# --source-machine-image cuda-v8 \
# --network-interface network=default \
# --metadata-from-file windows-startup-script-ps1=s.ps
# - name: Wait for runner registration
# run: |
# sleep 2m 30s
#
# delete-runner:
# if: ${{ success() || failure() || cancelled() }}
# needs: ['windows-gpu', 'start-runner']
# runs-on: ubuntu-20.04
# steps:
# - name: Set up Cloud SDK
# uses: google-github-actions/setup-gcloud@v0
# with:
# project_id: ${{ secrets.GCP_PROJECT_ID }}
# service_account_key: ${{ secrets.GCP_APPLICATION_CREDENTIALS }}
# export_default_credentials: true
#
# - name: Delete runner instance
# run: |
# gcloud compute --project=rstudio-cloudml instances delete runner-${{github.run_number}} --zone=us-central1-a
# - name: Delete runner from GH
# uses: actions/github-script@v3
# id: token
# with:
# github-token: ${{secrets.GH_TOKEN}}
# result-encoding: string
# script: |
# const runners = await github.actions.listSelfHostedRunnersForRepo({
# owner: 'mlverse',
# repo: 'torch'
# });
#
# const runner_id = runners.data.runners.filter((runner) => {
# return runner.name === 'runner-${{ github.run_number }}';
# })[0].id
#
# await github.actions.deleteSelfHostedRunnerFromRepo({
# owner: 'mlverse',
# repo: 'torch',
# runner_id: runner_id
# });
#
# windows-gpu:
# needs: ['start-runner']
# strategy:
# fail-fast: false
# matrix:
# r_version: ["release"]
# cuda: ["11.1"]
#
# runs-on: [self-hosted, windows, 'run-${{ github.run_number}}']
# name: 'Windows | CUDA: ${{ matrix.cuda }}'
# timeout-minutes: 120
# env:
# R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
# INSTALL_TORCH: 1
# TORCH_LOG: 2
# TORCH_TEST: 1
# TORCH_INSTALL: 1
# CUDA: ${{ matrix.cuda }}
#
# steps:
# - uses: actions/checkout@v3
# - uses: r-lib/actions/setup-r@v2
# with:
# r-version: ${{ matrix.r_version }}
# - uses: r-lib/actions/setup-pandoc@v2
# - name: Install dependencies
# run: |
# Rscript -e "options(repos=structure(c(CRAN='https://cloud.r-project.org/'))); install.packages(c('remotes', 'rcmdcheck'))" -e "remotes::install_deps(dependencies = TRUE)"
# - name: Build lantern and get libtorch
# if: contains( github.event.pull_request.labels.*.name, 'lantern')
# run: |
# Rscript tools/buildlantern.R
# - name: Check
# run: |
# withr::with_makevars(list(MAKEFLAGS="-j8"), {
# rcmdcheck::rcmdcheck(args = c("--no-multiarch", "--no-manual"), error_on = "error", check_dir = "check")
# })
# shell: Rscript {0}