Skip to content

Commit

Permalink
Tweaking docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Feb 6, 2022
1 parent 2779e01 commit 6d9c396
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions docs/src/tutorials/parallel.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,16 @@ julia> @floop begin

## [Executing code at the end of basecase](@id simple-completebasecase)

On GPU, the reduction result must be an immutable value (and not contain
GC-manged objects). Thus, we can use `SVector` for a histogram with a small
number of bins. However, indexing update on `SVector` is very inefficient
compared to `MVector`. Thus, it is better to execute the basecase reduction
using `MVector` while the cross-basecase reduction uses `SVector`. This
transformation be done by inserting the code after the `for` loop and before the
`@combine` expression.
On GPU, the reduction result must be an immutable value (and not contain any
GC-manged objects). This is often not a problem since Julia ecosystem has a
rich set of tooling for programming with immutable values. For example, we can
use [`StaticArrays.SVector`](https://github.com/JuliaArrays/StaticArrays.jl) for
a histogram with a small number of bins. However, indexing update on `SVector`
is very inefficient compared to `StaticArrays.MVector`. Thus, it is better to
execute the basecase reduction using `MVector` while the cross-basecase
reduction uses `SVector`. The transformation from `MVector` to `SVector` can be
done by inserting the code after the `for` loop and before the `@combine`
expression.

```jldoctest
julia> using FLoops
Expand Down

0 comments on commit 6d9c396

Please sign in to comment.