# I don't understand why it is slower with CuStaticSharedArray

**URL:** <https://discourse.julialang.org/t/i-dont-understand-why-it-is-slower-with-custaticsharedarray/126763>\
**Category:** New to Julia\
**Tags:** gpu, cuda, sharedarrays, cudajl\
**Created:** [March 10, 2025, 2:14pm UTC](https://discourse.julialang.org/t/i-dont-understand-why-it-is-slower-with-custaticsharedarray/126763 "2025-03-10T14:14:23Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![eldee](https://avatars.discourse-cdn.com/v4/letter/e/b5a626/32.png) [@eldee](https://discourse.julialang.org/u/eldee)\
**Post date:** [March 12, 2025, 5:16pm UTC](https://discourse.julialang.org/t/i-dont-understand-why-it-is-slower-with-custaticsharedarray/126763/4 "2025-03-12T17:16:16Z")

</div>

Thanks. Such diagrams are always useful.

But regarding the code, could you provide it in a form we can just run it by copy-pasting? I.e. something of the form

```julia
using CUDA, BenchmarkTools
(...)

const Ti = Int32
const Tf = Float64

const Δ::Tf = Tf(1e-2) # (we don't know what your df contains)
(...)

function kernel_comp_v_noshmem!(...)
    (...)
end

function kernel_comp_v!(...)
    (...)
end

v = (...) # e.g. CUDA.rand(...)
(...)

display(@benchmark CUDA.@sync begin 
   kernel_comp_v_noshmem!!($v_temp, $v, $F; threads = block_dim, blocks = grid_dim)
end)
display(@benchmark CUDA.@sync begin 
   comp_v!($v_temp, $v, $F; threads = block_dim, blocks = grid_dim)
end)

```

See also (point 4 in)

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …

---

_[View the full topic](https://discourse.julialang.org/t/i-dont-understand-why-it-is-slower-with-custaticsharedarray/126763)._
