Skip to content

Commit f128625

Browse files
committedJun 14, 2021
First commit
0 parents  commit f128625

15 files changed

+980
-0
lines changed
 

‎.github/workflows/sphinx.yml

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# From: https://github.com/rkdarst/sphinx-actions-test/blob/master/.github/workflows/sphinx-build.yml
2+
3+
name: sphinx
4+
on: [push, pull_request]
5+
6+
# If these SPHINXOPTS are enabled, then be strict about the builds and
7+
# fail on any warnings
8+
#env:
9+
# SPHINXOPTS: "-W --keep-going -T"
10+
env:
11+
DEFAULT_BRANCH: main
12+
13+
14+
jobs:
15+
build-and-deploy:
16+
name: Build and gh-pages
17+
runs-on: ubuntu-latest
18+
steps:
19+
# https://github.com/marketplace/actions/checkout
20+
- uses: actions/checkout@v2
21+
with:
22+
fetch-depth: 0
23+
lfs: true
24+
# https://github.com/marketplace/actions/setup-python
25+
# ^-- This gives info on matrix testing.
26+
- name: Install Python
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: 3.8
30+
# https://docs.github.com/en/actions/guides/building-and-testing-python#caching-dependencies
31+
# ^-- How to set up caching for pip on Ubuntu
32+
- name: Cache pip
33+
uses: actions/cache@v2
34+
with:
35+
path: ~/.cache/pip
36+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
37+
restore-keys: |
38+
${{ runner.os }}-pip-
39+
${{ runner.os }}-
40+
# https://docs.github.com/en/actions/guides/building-and-testing-python#installing-dependencies
41+
# ^-- This gives info on installing dependencies with pip
42+
- name: Install dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install -r requirements.txt
46+
- name: Debugging information
47+
run: |
48+
echo "github.ref:" ${{github.ref}}
49+
echo "github.event_name:" ${{github.event_name}}
50+
echo "github.head_ref:" ${{github.head_ref}}
51+
echo "github.base_ref:" ${{github.base_ref}}
52+
set -x
53+
git rev-parse --abbrev-ref HEAD
54+
git branch
55+
git branch -a
56+
git remote -v
57+
python -V
58+
pip list --not-required
59+
pip list
60+
61+
62+
# Build
63+
- uses: ammaraskar/sphinx-problem-matcher@master
64+
- name: Build Sphinx docs
65+
run: |
66+
make dirhtml
67+
# This fixes broken copy button icons, as explained in
68+
# https://github.com/coderefinery/sphinx-lesson/issues/50
69+
# https://github.com/executablebooks/sphinx-copybutton/issues/110
70+
# This can be removed once these PRs are accepted (but the
71+
# fixes also need to propagate to other themes):
72+
# https://github.com/sphinx-doc/sphinx/pull/8524
73+
# https://github.com/readthedocs/sphinx_rtd_theme/pull/1025
74+
sed -i 's/url_root="#"/url_root=""/' _build/dirhtml/index.html || true
75+
76+
77+
# The following supports building all branches and combining on
78+
# gh-pages
79+
80+
# Clone and set up the old gh-pages branch
81+
- name: Clone old gh-pages
82+
if: ${{ github.event_name == 'push' }}
83+
run: |
84+
set -x
85+
git fetch
86+
( git branch gh-pages remotes/origin/gh-pages && git clone . --branch=gh-pages _gh-pages/ ) || mkdir _gh-pages
87+
rm -rf _gh-pages/.git/
88+
mkdir -p _gh-pages/branch/
89+
# If a push and default branch, copy build to _gh-pages/ as the "main"
90+
# deployment.
91+
- name: Copy new build (default branch)
92+
if: |
93+
contains(github.event_name, 'push') &&
94+
contains(github.ref, env.DEFAULT_BRANCH)
95+
run: |
96+
set -x
97+
# Delete everything under _gh-pages/ that is from the
98+
# primary branch deployment. Eicludes the other branches
99+
# _gh-pages/branch-* paths, and not including
100+
# _gh-pages itself.
101+
find _gh-pages/ -mindepth 1 ! -path '_gh-pages/branch*' -delete
102+
rsync -a _build/dirhtml/ _gh-pages/
103+
# If a push and not on default branch, then copy the build to
104+
# _gh-pages/branch/$brname (transforming '/' into '--')
105+
- name: Copy new build (branch)
106+
if: |
107+
contains(github.event_name, 'push') &&
108+
!contains(github.ref, env.DEFAULT_BRANCH)
109+
run: |
110+
set -x
111+
#brname=$(git rev-parse --abbrev-ref HEAD)
112+
brname="${{github.ref}}"
113+
brname="${brname##refs/heads/}"
114+
brdir=${brname//\//--} # replace '/' with '--'
115+
rm -rf _gh-pages/branch/${brdir}
116+
rsync -a _build/dirhtml/ _gh-pages/branch/${brdir}
117+
# Go through each branch in _gh-pages/branch/, if it's not a
118+
# ref, then delete it.
119+
- name: Delete old feature branches
120+
if: ${{ github.event_name == 'push' }}
121+
run: |
122+
set -x
123+
for brdir in `ls _gh-pages/branch/` ; do
124+
brname=${brdir//--/\/} # replace '--' with '/'
125+
if ! git show-ref remotes/origin/$brname ; then
126+
echo "Removing $brdir"
127+
rm -r _gh-pages/branch/$brdir/
128+
fi
129+
done
130+
131+
# Add the .nojekyll file
132+
- name: nojekyll
133+
if: ${{ github.event_name == 'push' }}
134+
run: |
135+
touch _gh-pages/.nojekyll
136+
137+
# Deploy
138+
# https://github.com/peaceiris/actions-gh-pages
139+
- name: Deploy
140+
uses: peaceiris/actions-gh-pages@v3
141+
if: ${{ github.event_name == 'push' }}
142+
#if: ${{ success() && github.event_name == 'push' && github.ref == 'refs/heads/${{ env.DEFAULT_BRANCH }}' }}
143+
with:
144+
publish_branch: gh-pages
145+
github_token: ${{ secrets.GITHUB_TOKEN }}
146+
publish_dir: _gh-pages/
147+
force_orphan: true
148+

‎.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/_build
2+
.ipynb_checkpoints
3+
/venv*
4+
.jupyter_cache
5+
jupyter_execute

‎LICENSE

+396
Large diffs are not rendered by default.

‎LICENSE.code

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2021, Roberto Di Remigio and individual contributors.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

‎Makefile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = content
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

‎README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# HIP and SYCL
2+
3+
HIP and SYCL materials for ENCCS workshop
4+
5+
## Credit and license
6+
7+
- https://enccs.github.io/hip-and-sycl/#credits

‎content/_static/overrides.css

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
* colors = ['#0271AE', '#DC2830', '#FFC438', # blue, red, light orange
3+
* '#6E3B87', '#008D5D', '#FA902D', # purple, green, orange
4+
* '#0095B7', '#CB0C7B', '#F7E43C', # cyan, magenta, yellow
5+
* '#88B93B', '#444F95', '#F16232'] # pea green, dark blue, dark orange
6+
*
7+
* To use them in rST, you need to define a command in the epilog, see conf.py
8+
*/
9+
.blue {color: #0271AE;}
10+
.red {color: #DC2830;}
11+
.orange {color: #FFC438;}
12+
.purple {color: #633B87;}
13+
.green {color: #008D5D;}
14+
.dkorange {color: #FA902D;}
15+
.cyan {color: #0095B7;}
16+
.magenta {color: #CB0C8B;}
17+
.yellow {color: #F7E43C;}
18+
.peagreen {color: #88B93B;}
19+
.darkblue {color: #444F95;}
20+
.darkorange {color: #F16232;}
21+
22+
/* override colors in sphinx_lesson.css with the schemes here: https://personal.sron.nl/~pault/#sec:qualitative */
23+
24+
/* instructor-note */
25+
.rst-content .instructor-note {
26+
background: #DDDDDD;
27+
}
28+
.rst-content .instructor-note > .admonition-title {
29+
background: #BBBBBB;
30+
}
31+
.rst-content .instructor-note > .admonition-title::before {
32+
content: "";
33+
}
34+
35+
/* callout */
36+
.rst-content .callout {
37+
background: #EEEEBB;
38+
}
39+
.rst-content .callout > .admonition-title {
40+
background: #BBCC33;
41+
}
42+
43+
/* questions */
44+
.rst-content .questions {
45+
background: rgba(253, 219, 199, 0.3);
46+
}
47+
.rst-content .questions > .admonition-title {
48+
background: rgba(204, 51, 17, 0.5);
49+
}
50+
51+
/* discussion */
52+
.rst-content .discussion {
53+
background: rgba(231, 212, 232 0.3);
54+
}
55+
.rst-content .discussion > .admonition-title {
56+
background: rgba(194, 165, 207, 0.5);
57+
}
58+
59+
/* signature */
60+
.rst-content .signature {
61+
background: rgba(217, 240, 211, 0.3);
62+
}
63+
.rst-content .signature > .admonition-title {
64+
background: rgba(172, 211, 158, 0.5);
65+
}
66+
.rst-content .signature > .admonition-title::before {
67+
content: "\01F527";
68+
}
69+
70+
/* parameters */
71+
.rst-content .parameters {
72+
background: rgba(217, 240, 211, 0.0);
73+
}
74+
.rst-content .parameters > .admonition-title {
75+
background: rgba(172, 211, 158, 0.5);
76+
}
77+
.rst-content .parameters > .admonition-title::before {
78+
content: "\01F4BB";
79+
}
80+
81+
/* typealong */
82+
.rst-content .typealong {
83+
background: rgba(221, 221, 221, 0.3);
84+
}
85+
.rst-content .typealong > .admonition-title {
86+
background: rgba(187, 187, 187, 1.0);
87+
}
88+
.rst-content .typealong > .admonition-title::before {
89+
content: "\02328";
90+
}
91+
92+
/* Equation numbers to the right */
93+
.math {
94+
text-align: left;
95+
}
96+
.eqno {
97+
float: right;
98+
}

‎content/conf.py

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
# import os
14+
# import sys
15+
# sys.path.insert(0, os.path.abspath('.'))
16+
17+
18+
# -- Project information -----------------------------------------------------
19+
20+
project = "HIP and SYCL"
21+
copyright = "2021, Roberto Di Remigio and individual contributors."
22+
author = "Roberto Di Remigio and individual contributors."
23+
github_user = "ENCCS"
24+
github_repo_name = "hip-and-sycl"
25+
github_version = "main"
26+
conf_py_path = "/content/" # with leading and trailing slash
27+
28+
# -- General configuration ---------------------------------------------------
29+
30+
# Add any Sphinx extension module names here, as strings. They can be
31+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
32+
# ones.
33+
extensions = [
34+
# githubpages just adds a .nojekyll file
35+
"sphinx.ext.githubpages",
36+
"sphinx_lesson",
37+
# remove once sphinx_rtd_theme updated for contrast and accessibility:
38+
"sphinx_rtd_theme_ext_color_contrast",
39+
"sphinx.ext.todo",
40+
]
41+
42+
# Settings for myst_nb:
43+
# https://myst-nb.readthedocs.io/en/latest/use/execute.html#triggering-notebook-execution
44+
# jupyter_execute_notebooks = "off"
45+
# jupyter_execute_notebooks = "auto" # *only* execute if at least one output is missing.
46+
# jupyter_execute_notebooks = "force"
47+
jupyter_execute_notebooks = "cache"
48+
49+
# Add any paths that contain templates here, relative to this directory.
50+
# templates_path = ['_templates']
51+
52+
# List of patterns, relative to source directory, that match files and
53+
# directories to ignore when looking for source files.
54+
# This pattern also affects html_static_path and html_extra_path.
55+
exclude_patterns = [
56+
"README*",
57+
"_build",
58+
"Thumbs.db",
59+
".DS_Store",
60+
"jupyter_execute",
61+
"*venv*",
62+
]
63+
64+
# -- Options for HTML output -------------------------------------------------
65+
66+
# The theme to use for HTML and HTML Help pages. See the documentation for
67+
# a list of builtin themes.
68+
#
69+
html_theme = "sphinx_rtd_theme"
70+
html_logo = "img/ENCCS.jpg"
71+
html_favicon = "img/favicon.ico"
72+
73+
# Add any paths that contain custom static files (such as style sheets) here,
74+
# relative to this directory. They are copied after the builtin static files,
75+
# so a file named "default.css" will overwrite the builtin "default.css".
76+
html_static_path = ['_static']
77+
html_css_files = ["overrides.css"]
78+
79+
# HTML context:
80+
from os.path import basename, dirname, realpath
81+
82+
html_context = {
83+
"display_github": True,
84+
"github_user": github_user,
85+
# Auto-detect directory name. This can break, but
86+
# useful as a default.
87+
"github_repo": github_repo_name or basename(dirname(realpath(__file__))),
88+
"github_version": github_version,
89+
"conf_py_path": conf_py_path,
90+
}
91+
92+
# Intersphinx mapping. For example, with this you can use
93+
# :py:mod:`multiprocessing` to link straight to the Python docs of that module.
94+
# List all available references:
95+
# python -msphinx.ext.intersphinx https://docs.python.org/3/objects.inv
96+
# extensions.append('sphinx.ext.intersphinx')
97+
# intersphinx_mapping = {
98+
# #'python': ('https://docs.python.org/3', None),
99+
# #'sphinx': ('https://www.sphinx-doc.org/', None),
100+
# #'numpy': ('https://numpy.org/doc/stable/', None),
101+
# #'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
102+
# #'pandas': ('https://pandas.pydata.org/docs/', None),
103+
# #'matplotlib': ('https://matplotlib.org/', None),
104+
# 'seaborn': ('https://seaborn.pydata.org/', None),
105+
# }
106+
107+
# add few new directives
108+
from sphinx_lesson.directives import _BaseCRDirective
109+
110+
111+
class SignatureDirective(_BaseCRDirective):
112+
extra_classes = ["toggle-shown", "dropdown"]
113+
114+
115+
class ParametersDirective(_BaseCRDirective):
116+
extra_classes = ["dropdown"]
117+
118+
119+
class TypealongDirective(_BaseCRDirective):
120+
extra_classes = ["toggle-shown", "dropdown"]
121+
122+
123+
DIRECTIVES = [SignatureDirective, ParametersDirective, TypealongDirective]
124+
125+
126+
def setup(app):
127+
for obj in DIRECTIVES:
128+
app.add_directive(obj.cssname(), obj)

‎content/guide.rst

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Instructor's guide
2+
------------------

‎content/img/ENCCS.jpg

18.3 KB
Loading

‎content/img/favicon.ico

1.24 KB
Binary file not shown.

‎content/index.rst

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
HIP and SYCL
2+
============
3+
4+
5+
Intro
6+
7+
8+
9+
.. prereq::
10+
11+
prerequisites
12+
13+
14+
15+
.. csv-table::
16+
:widths: auto
17+
:delim: ;
18+
19+
20 min ; :doc:`filename`
20+
21+
22+
.. toctree::
23+
:maxdepth: 1
24+
:caption: The lesson
25+
26+
27+
.. toctree::
28+
:maxdepth: 1
29+
:caption: Reference
30+
31+
quick-reference
32+
guide
33+
34+
35+
36+
.. _learner-personas:
37+
38+
Who is the course for?
39+
----------------------
40+
41+
42+
43+
44+
45+
About the course
46+
----------------
47+
48+
49+
50+
51+
52+
53+
See also
54+
--------
55+
56+
57+
58+
59+
60+
Credits
61+
-------
62+
63+
The lesson file structure and browsing layout is inspired by and derived from
64+
`work <https://github.com/coderefinery/sphinx-lesson>`_ by `CodeRefinery
65+
<https://coderefinery.org/>`_ licensed under the `MIT license
66+
<http://opensource.org/licenses/mit-license.html>`_. We have copied and adapted
67+
most of their license text.
68+
69+
Instructional Material
70+
^^^^^^^^^^^^^^^^^^^^^^
71+
72+
This instructional material is made available under the
73+
`Creative Commons Attribution license (CC-BY-4.0) <https://creativecommons.org/licenses/by/4.0/>`_.
74+
The following is a human-readable summary of (and not a substitute for) the
75+
`full legal text of the CC-BY-4.0 license
76+
<https://creativecommons.org/licenses/by/4.0/legalcode>`_.
77+
You are free to:
78+
79+
- **share** - copy and redistribute the material in any medium or format
80+
- **adapt** - remix, transform, and build upon the material for any purpose,
81+
even commercially.
82+
83+
The licensor cannot revoke these freedoms as long as you follow these license terms:
84+
85+
- **Attribution** - You must give appropriate credit (mentioning that your work
86+
is derived from work that is Copyright (c) Roberto Di Remigio and individual contributors and, where practical, linking
87+
to `<https://enccs.se>`_), provide a `link to the license
88+
<https://creativecommons.org/licenses/by/4.0/>`_, and indicate if changes were
89+
made. You may do so in any reasonable manner, but not in any way that suggests
90+
the licensor endorses you or your use.
91+
- **No additional restrictions** - You may not apply legal terms or
92+
technological measures that legally restrict others from doing anything the
93+
license permits.
94+
95+
With the understanding that:
96+
97+
- You do not have to comply with the license for elements of the material in
98+
the public domain or where your use is permitted by an applicable exception
99+
or limitation.
100+
- No warranties are given. The license may not give you all of the permissions
101+
necessary for your intended use. For example, other rights such as
102+
publicity, privacy, or moral rights may limit how you use the material.
103+
104+
105+
106+
Software
107+
^^^^^^^^
108+
109+
Except where otherwise noted, the example programs and other software provided
110+
with this repository are made available under the `OSI <http://opensource.org/>`_-approved
111+
`MIT license <https://opensource.org/licenses/mit-license.html>`_.
112+

‎content/quick-reference.rst

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Quick Reference
2+
---------------

‎make.bat

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.http://sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

‎requirements.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Sphinx
2+
sphinx_rtd_theme
3+
sphinx_rtd_theme_ext_color_contrast
4+
myst_nb
5+
sphinx-lesson

0 commit comments

Comments
 (0)
Please sign in to comment.