Skip to content

Commit 7cc525f

Browse files
committed
INF: Setup initial Infrastructure
1 parent 55d6904 commit 7cc525f

File tree

14 files changed

+2988
-0
lines changed

14 files changed

+2988
-0
lines changed

.github/workflows/cache.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Build Cache [using jupyter-book]
2+
on:
3+
push:
4+
branches:
5+
- main
6+
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
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 }}
36+
# Install LaTeX (Support for matplotlib)
37+
- name: Install latex dependencies
38+
shell: bash -l {0}
39+
run: |
40+
apt-get -qq update
41+
export DEBIAN_FRONTEND=noninteractive
42+
apt-get install -y tzdata
43+
apt-get install -y \
44+
texlive-latex-recommended \
45+
texlive-latex-extra \
46+
texlive-fonts-recommended \
47+
texlive-fonts-extra \
48+
texlive-xetex \
49+
latexmk \
50+
xindy \
51+
dvipng \
52+
ghostscript \
53+
cm-super
54+
- name: Setup Anaconda
55+
uses: conda-incubator/setup-miniconda@v2
56+
with:
57+
auto-update-conda: true
58+
auto-activate-base: true
59+
miniconda-version: 'latest'
60+
python-version: 3.9
61+
environment-file: environment.yml
62+
activate-environment: quantecon
63+
- name: Install Jax and Upgrade CUDA
64+
shell: bash -l {0}
65+
run: |
66+
pip install --upgrade "jax[cuda]==0.4.2" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
67+
pip install --upgrade "numpyro[cuda]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
68+
nvidia-smi
69+
- name: Build HTML
70+
shell: bash -l {0}
71+
run: |
72+
jb build lectures --path-output ./ -W --keep-going
73+
- name: Upload Execution Reports
74+
uses: actions/upload-artifact@v2
75+
if: failure()
76+
with:
77+
name: execution-reports
78+
path: _build/html/reports
79+
- name: Upload "_build" folder (cache)
80+
uses: actions/upload-artifact@v3
81+
with:
82+
name: build-cache
83+
path: _build

.github/workflows/ci.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: Build Project [using jupyter-book]
2+
on: [pull_request]
3+
jobs:
4+
deploy-runner:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: iterative/setup-cml@v1
8+
- uses: actions/checkout@v3
9+
with:
10+
ref: ${{ github.event.pull_request.head.sha }}
11+
- name: Deploy runner on EC2
12+
env:
13+
REPO_TOKEN: ${{ secrets.QUANTECON_SERVICES_PAT }}
14+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
15+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
16+
run: |
17+
cml runner launch \
18+
--cloud=aws \
19+
--cloud-region=us-west-2 \
20+
--cloud-type=p3.2xlarge \
21+
--labels=cml-gpu \
22+
--cloud-hdd-size=40
23+
preview:
24+
needs: deploy-runner
25+
runs-on: [self-hosted, cml-gpu]
26+
container:
27+
image: docker://nvidia/cuda:11.8.0-devel-ubuntu22.04
28+
options: --gpus all
29+
steps:
30+
- uses: actions/checkout@v3
31+
with:
32+
ref: ${{ github.event.pull_request.head.sha }}
33+
# Install LaTeX (Support for matplotlib and PDF builds)
34+
- name: Install latex dependencies
35+
shell: bash -l {0}
36+
run: |
37+
apt-get -qq update
38+
export DEBIAN_FRONTEND=noninteractive
39+
apt-get install -y tzdata
40+
apt-get install -y \
41+
texlive-latex-recommended \
42+
texlive-latex-extra \
43+
texlive-fonts-recommended \
44+
texlive-fonts-extra \
45+
texlive-xetex \
46+
latexmk \
47+
xindy \
48+
dvipng \
49+
ghostscript \
50+
cm-super
51+
- name: Setup Anaconda
52+
uses: conda-incubator/setup-miniconda@v2
53+
with:
54+
auto-update-conda: true
55+
auto-activate-base: true
56+
miniconda-version: 'latest'
57+
python-version: 3.9
58+
environment-file: environment.yml
59+
activate-environment: quantecon
60+
- name: Install Jax and Upgrade CUDA
61+
shell: bash -l {0}
62+
run: |
63+
pip install --upgrade "jax[cuda]==0.4.2" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
64+
pip install --upgrade "numpyro[cuda]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
65+
nvidia-smi
66+
- name: Install latex dependencies
67+
shell: bash -l {0}
68+
run: |
69+
apt-get -qq update
70+
export DEBIAN_FRONTEND=noninteractive
71+
apt-get install -y tzdata
72+
apt-get install -y \
73+
texlive-latex-recommended \
74+
texlive-latex-extra \
75+
texlive-fonts-recommended \
76+
texlive-fonts-extra \
77+
texlive-xetex \
78+
latexmk \
79+
xindy
80+
- name: Display Conda Environment Versions
81+
shell: bash -l {0}
82+
run: conda list
83+
- name: Display Pip Versions
84+
shell: bash -l {0}
85+
run: pip list
86+
# - name: Download "build" folder (cache)
87+
# uses: dawidd6/action-download-artifact@v2
88+
# with:
89+
# workflow: cache.yml
90+
# branch: main
91+
# name: build-cache
92+
# path: _build
93+
# Build Assets (Download Notebooks and PDF via LaTeX)
94+
- name: Build PDF from LaTeX
95+
shell: bash -l {0}
96+
run: |
97+
jb build lectures --builder pdflatex --path-output ./ -n -W --keep-going
98+
mkdir _build/html/_pdf
99+
cp -u _build/latex/*.pdf _build/html/_pdf
100+
- name: Upload Execution Reports (LaTeX)
101+
uses: actions/upload-artifact@v2
102+
if: failure()
103+
with:
104+
name: execution-reports
105+
path: _build/latex/reports
106+
- name: Build Download Notebooks (sphinx-tojupyter)
107+
shell: bash -l {0}
108+
run: |
109+
jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter -n -W --keep-going
110+
mkdir -p _build/html/_notebooks
111+
cp -u _build/jupyter/*.ipynb _build/html/_notebooks
112+
# Final Build of HTML
113+
- name: Build HTML
114+
shell: bash -l {0}
115+
run: |
116+
jb build lectures --path-output ./ -n -W --keep-going
117+
- name: Upload Execution Reports (HTML)
118+
uses: actions/upload-artifact@v2
119+
if: failure()
120+
with:
121+
name: execution-reports
122+
path: _build/html/reports
123+
- name: Preview Deploy to Netlify
124+
uses: nwtgck/actions-netlify@v1.1
125+
with:
126+
publish-dir: '_build/html/'
127+
production-branch: main
128+
github-token: ${{ secrets.GITHUB_TOKEN }}
129+
deploy-message: "Preview Deploy from GitHub Actions"
130+
env:
131+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
132+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
_build/
3+
lectures/_build/

environment.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: quantecon
2+
channels:
3+
- default
4+
dependencies:
5+
- python=3.9
6+
- anaconda=2022.10
7+
- pip
8+
- pip:
9+
- jupyter-book==0.15.1
10+
- quantecon-book-theme==0.4.0
11+
- sphinx-tojupyter==0.13.0
12+
- sphinxext-rediraffe==0.2.7
13+
- sphinx-exercise==0.4.1
14+
- docutils==0.17.1
15+
- ghp-import==1.1.0
16+
- sphinxcontrib-youtube==1.1.0
17+
- sphinx-togglebutton==0.3.1
18+
- arviz==0.13.0
19+
- kaleido
20+
# Sandpit Requirements
21+
# - quantecon
22+
# - array-to-latex
23+
# - PuLP
24+
# - cvxpy
25+
# - cvxopt
26+
# - cylp
27+
# - prettytable

lectures/_config.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
title: Quantitative Economics with Python using JAX
2+
author: Thomas J. Sargent & John Stachurski
3+
logo: _static/qe-logo-large.png
4+
description: This website presents a set of lectures on quantitative economic modeling, designed and written by Thomas J. Sargent and John Stachurski.
5+
# analytics:
6+
# google_analytics_id:
7+
8+
parse:
9+
myst_enable_extensions:
10+
- amsmath
11+
- colon_fence
12+
- deflist
13+
- dollarmath
14+
- html_admonition
15+
- html_image
16+
- linkify
17+
- replacements
18+
- smartquotes
19+
- substitution
20+
21+
only_build_toc_files: true
22+
execute:
23+
execute_notebooks: "cache"
24+
timeout: 2400
25+
26+
bibtex_bibfiles:
27+
- _static/quant-econ.bib
28+
29+
html:
30+
baseurl: https://jax.quantecon.org/
31+
32+
latex:
33+
latex_documents:
34+
targetname: quantecon-jax.tex
35+
36+
sphinx:
37+
extra_extensions: [sphinx_multitoc_numbering, sphinxext.rediraffe, sphinxcontrib.youtube, sphinx.ext.todo, sphinx_exercise, sphinx_togglebutton, sphinx_tojupyter]
38+
config:
39+
nb_mime_priority_overrides: [
40+
['html', 'application/vnd.jupyter.widget-view+json', 10],
41+
['html', 'application/javascript', 20],
42+
['html', 'text/html', 30],
43+
['html', 'text/latex', 40],
44+
['html', 'image/svg+xml', 50],
45+
['html', 'image/png', 60],
46+
['html', 'image/jpeg', 70],
47+
['html', 'text/markdown', 80],
48+
['html', 'text/plain', 90],
49+
['jupyter', 'application/vnd.jupyter.widget-view+json', 10],
50+
['jupyter', 'application/javascript', 20],
51+
['jupyter', 'text/html', 30],
52+
['jupyter', 'text/latex', 40],
53+
['jupyter', 'image/svg+xml', 50],
54+
['jupyter', 'image/png', 60],
55+
['jupyter', 'image/jpeg', 70],
56+
['jupyter', 'text/markdown', 80],
57+
['jupyter', 'text/plain', 90],
58+
['latex', 'text/latex', 10],
59+
['latex', 'application/pdf', 20],
60+
['latex', 'image/png', 30],
61+
['latex', 'image/jpeg', 40],
62+
['latex', 'text/markdown', 50],
63+
['latex', 'text/plain', 60]
64+
]
65+
html_favicon: _static/lectures-favicon.ico
66+
html_theme: quantecon_book_theme
67+
html_static_path: ['_static']
68+
html_theme_options:
69+
header_organisation_url: https://quantecon.org
70+
header_organisation: QuantEcon
71+
repository_url: https://github.com/QuantEcon/lecture-jax
72+
nb_repository_url: https://github.com/QuantEcon/lecture-jax.notebooks
73+
twitter: quantecon
74+
twitter_logo_url: https://assets.quantecon.org/img/qe-twitter-logo.png
75+
og_logo_url: https://assets.quantecon.org/img/qe-og-logo.png
76+
description: This website presents a set of lectures on quantitative economic modeling, designed and written by Thomas J. Sargent and John Stachurski.
77+
keywords: Python, QuantEcon, Quantitative Economics, Economics, Sloan, Alfred P. Sloan Foundation, Tom J. Sargent, John Stachurski
78+
launch_buttons:
79+
colab_url: https://colab.research.google.com
80+
mathjax3_config:
81+
tex:
82+
macros:
83+
"argmax" : "arg\\,max"
84+
"argmin" : "arg\\,min"
85+
mathjax_path: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
86+
rediraffe_redirects:
87+
index_toc.md: intro.md
88+
tojupyter_static_file_path: ["source/_static", "_static"]
89+
tojupyter_target_html: true
90+
tojupyter_urlpath: "https://python.quantecon.org/"
91+
tojupyter_image_urlpath: "https://python.quantecon.org/_static/"
92+
tojupyter_lang_synonyms: ["ipython", "ipython3", "python"]
93+
tojupyter_kernels:
94+
python3:
95+
kernelspec:
96+
display_name: "Python"
97+
language: python3
98+
name: python3
99+
file_extension: ".py"
100+
tojupyter_images_markdown: true
1.8 KB
Loading
1.52 KB
Binary file not shown.

lectures/_static/qe-logo-large.png

1.32 KB
Loading

0 commit comments

Comments
 (0)