-
Notifications
You must be signed in to change notification settings - Fork 114
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
Taal: Should we use @inbounds
+ @boundscheck
to increase standard performance?
#210
Comments
Maybe we can use a hybrid way for now: If we want to introduce additional bounds checks, we hide them inside Lines 22 to 23 in 2c670e2
Trixi.jl/src/solvers/dg/2d/amr.jl Lines 59 to 62 in 2c670e2
We don't use @inbounds for now, though.
|
Result: Use Lines 22 to 23 in 2c670e2
but not for sanity checks such as Trixi.jl/src/solvers/dg/2d/amr.jl Lines 59 to 62 in 2c670e2
Keep the status quo of requiring julia --check-bounds=no for optimal performance.
|
From my perspective, the first example is just on the edge between being a bounds check and a logic check. However, an open-and-shut example for Trixi.jl/src/callbacks/amr_dg2d.jl Lines 97 to 108 in 5120d7b
|
Just in case we decide to change the default behavior in the future: Stuff like @inline function multiply_add_to_node_vars!(...) should be Base.@propagate_inbounds function multiply_add_to_node_vars!(...) |
We might need to revisit this based on the outcome of JuliaLang/julia#48245 |
I think we should have a discussion about our way of boundschecking in general. There are at least two possible ways:
@boundscheck
blocks and@inbounds
afterwards to make the assumptions on bounds explicit and the code fast even if the users start Julia with default arguments. While debugging some code, we can start Julia with the flag--check-bounds=yes
to override@inbounds
.@boundscheck
or@inbounds
at all. By default, Julia will check bounds on every access. Hence, users need to start Julia with--check-bounds=no
(or--check-bounds=0
in @sloede's custom build 😉) - our status quo.Personally, I favor the first option.
Originally posted by @ranocha in #203 (comment)
The text was updated successfully, but these errors were encountered: