-
Notifications
You must be signed in to change notification settings - Fork 50
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
Modify example: 05_slice
to use 'DefaultExecutionSpace'
#673
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,8 +64,12 @@ void sliceExample() | |
allocated on NVIDIA devices use `Kokkos::CudaSpace` instead of | ||
`Kokkos::HostSpace`. | ||
*/ | ||
// using MemorySpace = Kokkos::CudaSpace; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove |
||
// using ExecutionSpace = Kokkos::Cuda; | ||
|
||
using MemorySpace = Kokkos::HostSpace; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to match the execution space. |
||
using ExecutionSpace = Kokkos::DefaultHostExecutionSpace; | ||
using ExecutionSpace = Kokkos::DefaultExecutionSpace; | ||
|
||
using DeviceType = Kokkos::Device<ExecutionSpace, MemorySpace>; | ||
|
||
/* | ||
|
@@ -88,9 +92,13 @@ void sliceExample() | |
because slices are unmanaged memory but may still be used for diagnostic | ||
purposes. | ||
*/ | ||
auto slice_0 = Cabana::slice<0>( aosoa, "my_slice_0" ); | ||
auto slice_1 = Cabana::slice<1>( aosoa, "my_slice_1" ); | ||
auto slice_2 = Cabana::slice<2>( aosoa, "my_slice_2" ); | ||
// Create a mirror view of the aosoa on the host for accessing it legally | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this mirror creation above the slice comment |
||
auto aosoa_host = | ||
Cabana::create_mirror_view_and_copy( Kokkos::HostSpace(), aosoa ); | ||
|
||
auto slice_0 = Cabana::slice<0>( aosoa_host, "my_slice_0" ); | ||
auto slice_1 = Cabana::slice<1>( aosoa_host, "my_slice_1" ); | ||
auto slice_2 = Cabana::slice<2>( aosoa_host, "my_slice_2" ); | ||
|
||
/* | ||
Let's initialize the data using the 2D indexing scheme. Slice data can | ||
|
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.
This comment will need to be updated to describe that this example uses default spaces to work across all supported backends, but explicit choices like HostSpace and CudaSpace can also be used.