Skip to content

Commit f50ed31

Browse files
authored
ENH: GPU Support for Preview, Cache and Publish (#243)
* ENH: Move cache,preview,publish workflows to build with GPU support via EC2 * fix latex for publish workflows
1 parent a60b34a commit f50ed31

File tree

4 files changed

+91
-16
lines changed

4 files changed

+91
-16
lines changed

.github/workflows/cache.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,35 @@ on:
44
branches:
55
- main
66
jobs:
7-
tests:
7+
deploy-runner:
88
runs-on: ubuntu-latest
99
steps:
10-
- name: Checkout
11-
uses: actions/checkout@v2
10+
- uses: iterative/setup-cml@v1
11+
- uses: actions/checkout@v3
12+
with:
13+
ref: ${{ github.event.pull_request.head.sha }}
14+
- name: Deploy runner on EC2
15+
env:
16+
REPO_TOKEN: ${{ secrets.QUANTECON_SERVICES_PAT }}
17+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
18+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
19+
run: |
20+
cml runner launch \
21+
--cloud=aws \
22+
--cloud-region=us-west-2 \
23+
--cloud-type=p3.2xlarge \
24+
--labels=cml-gpu \
25+
--cloud-hdd-size=40
26+
cache:
27+
needs: deploy-runner
28+
runs-on: [self-hosted, cml-gpu]
29+
container:
30+
image: docker://nvidia/cuda:11.2.1-devel-ubuntu20.04
31+
options: --gpus all
32+
steps:
33+
- uses: actions/checkout@v3
34+
with:
35+
ref: ${{ github.event.pull_request.head.sha }}
1236
- name: Setup Anaconda
1337
uses: conda-incubator/setup-miniconda@v2
1438
with:
@@ -18,6 +42,11 @@ jobs:
1842
python-version: 3.9
1943
environment-file: environment.yml
2044
activate-environment: quantecon
45+
- name: Install Jax and Upgrade CUDA
46+
shell: bash -l {0}
47+
run: |
48+
pip install --upgrade "jax[cuda]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
49+
nvidia-smi
2150
- name: Build HTML
2251
shell: bash -l {0}
2352
run: |

.github/workflows/ci-ec2-gpu.yml renamed to .github/workflows/ci.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ jobs:
1717
cml runner launch \
1818
--cloud=aws \
1919
--cloud-region=us-west-2 \
20-
--cloud-type=p2.xlarge \
21-
--labels=cml-gpu
20+
--cloud-type=p3.2xlarge \
21+
--labels=cml-gpu \
22+
--cloud-hdd-size=40
2223
preview:
2324
needs: deploy-runner
2425
runs-on: [self-hosted, cml-gpu]
2526
container:
26-
image: docker://iterativeai/cml:latest-gpu
27+
image: docker://nvidia/cuda:11.2.1-devel-ubuntu20.04
2728
options: --gpus all
2829
steps:
2930
- uses: actions/checkout@v3
@@ -38,10 +39,18 @@ jobs:
3839
python-version: 3.9
3940
environment-file: environment.yml
4041
activate-environment: quantecon
42+
- name: Install Jax and Upgrade CUDA
43+
shell: bash -l {0}
44+
run: |
45+
pip install --upgrade "jax[cuda]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
46+
nvidia-smi
4147
- name: Install latex dependencies
48+
shell: bash -l {0}
4249
run: |
43-
sudo apt-get -qq update
44-
sudo apt-get install -y \
50+
apt-get -qq update
51+
export DEBIAN_FRONTEND=noninteractive
52+
apt-get install -y tzdata
53+
apt-get install -y \
4554
texlive-latex-recommended \
4655
texlive-latex-extra \
4756
texlive-fonts-recommended \
@@ -80,6 +89,12 @@ jobs:
8089
shell: bash -l {0}
8190
run: |
8291
jb build lectures --path-output ./ -n -W --keep-going
92+
- name: Upload Execution Reports
93+
uses: actions/upload-artifact@v2
94+
if: failure()
95+
with:
96+
name: execution-reports
97+
path: _build/html/reports
8398
- name: Preview Deploy to Netlify
8499
uses: nwtgck/[email protected]
85100
with:

.github/workflows/publish.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,32 @@ on:
44
tags:
55
- 'publish*'
66
jobs:
7+
deploy-runner:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: iterative/setup-cml@v1
11+
- uses: actions/checkout@v3
12+
with:
13+
ref: ${{ github.event.pull_request.head.sha }}
14+
- name: Deploy runner on EC2
15+
env:
16+
REPO_TOKEN: ${{ secrets.QUANTECON_SERVICES_PAT }}
17+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
18+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
19+
run: |
20+
cml runner launch \
21+
--cloud=aws \
22+
--cloud-region=us-west-2 \
23+
--cloud-type=p3.2xlarge \
24+
--labels=cml-gpu \
25+
--cloud-hdd-size=40
726
publish:
827
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
9-
runs-on: ubuntu-latest
28+
needs: deploy-runner
29+
runs-on: [self-hosted, cml-gpu]
30+
container:
31+
image: docker://nvidia/cuda:11.2.1-devel-ubuntu20.04
32+
options: --gpus all
1033
steps:
1134
- name: Checkout
1235
uses: actions/checkout@v2
@@ -19,10 +42,17 @@ jobs:
1942
python-version: 3.9
2043
environment-file: environment.yml
2144
activate-environment: quantecon
45+
- name: Install Jax and Upgrade CUDA
46+
shell: bash -l {0}
47+
run: |
48+
pip install --upgrade "jax[cuda]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
49+
nvidia-smi
2250
- name: Install latex dependencies
2351
run: |
24-
sudo apt-get -qq update
25-
sudo apt-get install -y \
52+
apt-get -qq update
53+
export DEBIAN_FRONTEND=noninteractive
54+
apt-get install -y tzdata
55+
apt-get install -y \
2656
texlive-latex-recommended \
2757
texlive-latex-extra \
2858
texlive-fonts-recommended \

environment.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ dependencies:
1414
- ghp-import==1.1.0
1515
- sphinxcontrib-youtube==1.1.0
1616
- sphinx-togglebutton==0.3.1
17-
# Sandpit Requirements
1817
- quantecon
1918
- array-to-latex
20-
- PuLP
21-
- cvxpy
22-
- cvxopt
23-
- cylp
2419
- prettytable
20+
# Sandpit Requirements
21+
# - PuLP
22+
# - cvxpy
23+
# - cvxopt
24+
# - cylp
25+

0 commit comments

Comments
 (0)