Skip to content

Commit

Permalink
Add links to Compiler Explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Oct 24, 2023
1 parent 20088e9 commit 451f12a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Checkout kokkos
uses: actions/checkout@v3
with:
repository: kokkos/kokkos
path: kokkos
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@v4
with:
Expand Down
9 changes: 9 additions & 0 deletions docs/source/API/core/parallel-dispatch/parallel_for.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ More Detailed Examples are provided in the ExecutionPolicy documentation.
Kokkos::finalize();
}
.. raw:: html

<a href="https://godbolt.org/z/q9h339vob" target="_blank">Edit on Compiler Explorer</a>

.. ceinclude:: ../../../../../kokkos/example/tutorial/01_hello_world_lambda/hello_world_lambda.cpp
:language: cpp
:start-after: Kokkos::initialize
:end-before: Kokkos::finalize

* ``TeamPolicy`` policy with C++ struct as functor. Note that the KOKKOS_INLINE_FUNCTION macro adds all of the function specifiers necessary for the target execution space. The TagA/B structs also provide the ability to 'overload' the operators within the same functor. Much like the lambda example, the functor and any member variables contained within are captured by value, which means they must have either implicit or explicit copy constructors.

.. code-block:: cpp
Expand Down
20 changes: 20 additions & 0 deletions docs/source/ceinclude.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from docutils import nodes
from sphinx.directives.code import LiteralInclude, container_wrapper

class CeIncludeDirective(LiteralInclude):
""" LiteralInclude with a Compiler Explorer link"""

def run(self):
retnode = super().run()[0]
# paragraph_node = nodes.paragraph(text='Hello World!')
retnode = container_wrapper(self, retnode, "https://godbolt.org/z/q9h339vob")
return [retnode]

def setup(app):
app.add_directive("ceinclude", CeIncludeDirective)

return {
'version': '0.1',
'parallel_read_safe': True,
'parallel_write_safe': True,
}
3 changes: 2 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"sphinx.ext.viewcode",
"sphinx.ext.intersphinx",
"sphinx_copybutton",
"cppkokkos"]
"cppkokkos",
"ceinclude"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down

0 comments on commit 451f12a

Please sign in to comment.