Skip to content
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

Improve documentation for virtual functions #551

Merged
merged 20 commits into from
Oct 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/source/ProgrammingGuide/Kokkos-and-Virtual-Functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ For a full working example, see [the example in the repo](https://github.com/kok

## What if I need a setter that works with host values?

The first problem people run into with this is that they want to initialize some fields based on host data, with a setter which is *not* a virtual function.
Calling this setter on the device would crash if the host data is not easily copyable on the device (e.g. for a small array).
The first problem people run into with this is when they want to initialize some fields based on host data, using a setter which is *not* a virtual function.
Calling this setter on the device would crash if the host data doesn't form a valid type on the device: especially, if the data type is not copyable on the device (e.g. for a pointer), or if the data instance is invalid on the device.
The most productive solution we've found in these cases is to allocate the instance in `SharedSpace`, initialize it on the device, and then fill in fields on the host

```c++
Expand Down
Loading