-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add embedded compiler-explorer example #444
base: main
Are you sure you want to change the base?
Conversation
Another way to enforce that the code snippets in documentation are compiling: literal include (2e525e9). |
702afc5
to
2e525e9
Compare
Hm, interesting, I was thinking of much simpler: i.e. have a code snippet and then a short link to godbolt. Obviously that wouldn't guarantee that they are the same thing. |
TODO:
|
65c975b
to
91b9c73
Compare
.. raw:: html | ||
|
||
<a href="https://godbolt.org/z/q9h339vob" target="_blank">Edit on Compiler Explorer</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. ceinclude:: ../../../../../kokkos/example/tutorial/01_hello_world_lambda/hello_world_lambda.cpp | ||
:language: cpp | ||
:start-after: Kokkos::initialize | ||
:end-before: Kokkos::finalize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
helo_world_lambda.cpp
+ an auto-generated link using clientstate API:
See live version.
See ceinclude.py
for extension details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the number of comments in this file, I would rather not include that one specifically. Other than that, it's a good idea to use examples we run through our CI. I could see that we just reduce the verbosity in these files and refer to kokkos-tutorials
for more extensive tutorials.
@cz4rs , @masterleinad - What do we need to do next to work towards completion of this issue? |
Hi @ajpowelsnl! As far as I know there was no decision (or even major discussion) regarding how much integration and how many changes we want to do. Assuming we just want to update existing snippets with
IMHO the second option is clearly better (less maintenance!), with the only downside being that the generated links are quite long and ugly:
|
This is not mergeable, just providing actual examples for the next documentation session.
Sphinx allows for html injection with
.. raw:: html
. That's probably the easiest way to useShare
->Embed in iframe
functionality available in compiler-explorer.See initialization example below (our current approach is kept for comparison):
Code used:
Note: there is some customization available when generating the link (
Read only
,Hide editor toolbars
). Further configuration is contained in the generated link.