Skip to content

Commit

Permalink
Use literal include to add Kokkos example
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Jul 31, 2023
1 parent 4bedc40 commit 2e525e9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
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
8 changes: 8 additions & 0 deletions docs/source/API/core/Initialize-and-Finalize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ Switching to ``Kokkos::ScopeGuard`` fixes it:
// ScopeGuard destructor called, calls Kokkos::finalize
}
Included directly from Kokkos source:

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

In the above example, ``my_view`` will not go out of scope until the end of the main() function. Without ``ScopeGuard``, ``Kokkos::finalize`` will be called before ``my_view`` is out of scope. With ``ScopeGuard``, ``ScopeGuard`` will be dereferenced (subsequently calling ``Kokkos::finalize``) after ``my_view`` is dereferenced, which ensures the proper order during shutdown.

.. toctree::
Expand Down

0 comments on commit 2e525e9

Please sign in to comment.