You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27Lines changed: 27 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -248,3 +248,30 @@ false
248
248
Since the original array `dest` cannot hold the input, a new array is created (`ans !== dest`).
249
249
250
250
Combined with [function barriers](https://docs.julialang.org/en/latest/manual/performance-tips/#kernel-functions-1), `append!!` is a useful building block for implementing `collect`-like functions.
251
+
252
+
## Advanced: using StructArrays in CUDA kernels
253
+
254
+
It is possible to combine StructArrays with [CUDAnative](https://github.com/JuliaGPU/CUDAnative.jl), in order to create CUDA kernels that work on StructArrays directly on the GPU. Make sure you are familiar with the CUDAnative documentation (esp. kernels with plain `CuArray`s) before experimenting with kernels based on `StructArray`s.
255
+
256
+
```julia
257
+
using CUDAnative, CuArrays, StructArrays
258
+
d =StructArray(a =rand(100), b =rand(100))
259
+
260
+
# move to GPU
261
+
dd =replace_storage(CuArray, d)
262
+
de =similar(dd)
263
+
264
+
# a simple kernel, to copy the content of `dd` onto `de`
0 commit comments