# Two CuDeviceArrays inside one kernel

**URL:** <https://discourse.julialang.org/t/two-cudevicearrays-inside-one-kernel/84977>\
**Category:** General Usage\
**Created:** [July 29, 2022, 1:03pm UTC](https://discourse.julialang.org/t/two-cudevicearrays-inside-one-kernel/84977 "2022-07-29T13:03:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shirakumo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shirakumo/32/38369_2.png) [@Shirakumo](https://discourse.julialang.org/u/Shirakumo)\
**Post date:** [July 29, 2022, 1:03pm UTC](https://discourse.julialang.org/t/two-cudevicearrays-inside-one-kernel/84977/1 "2022-07-29T13:03:53Z")

</div>

Hello everyone,

I was wondering if I can achieve something like this:

```julia
function test(output, output2, input)

    # Set up shared memory cache for this current block.
    cache1 = @cuDynamicSharedMem(Int64, (10,10,3))
    cache2 = @cuDynamicSharedMem(Int64, (5,5))

end

```

I have two small arrays which I compute on the device so I want them to be there for faster access. However, I’m not sure if I can use shared memory for this because in my example cache2 overwrites cache1. Is there any way to have two separate arrays which are shared among one thread block? I tried to read about CuDeviceArrays but can’t find any example how to use them. I’ll really appreciate your help.

Greetings
