# CUDA.@cuStaticSharedMem returning a Structure of Arrays

**URL:** <https://discourse.julialang.org/t/cuda-custaticsharedmem-returning-a-structure-of-arrays/65307>\
**Category:** GPU\
**Created:** [July 26, 2021, 2:13pm UTC](https://discourse.julialang.org/t/cuda-custaticsharedmem-returning-a-structure-of-arrays/65307 "2021-07-26T14:13:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shiroghost](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@shiroghost](https://discourse.julialang.org/u/shiroghost)\
**Post date:** [July 26, 2021, 2:13pm UTC](https://discourse.julialang.org/t/cuda-custaticsharedmem-returning-a-structure-of-arrays/65307/1 "2021-07-26T14:13:30Z")

</div>

Working on the GPU I usually find convenient to use Structure of Arrays. I use [GitHub - JuliaArrays/StructArrays.jl: Efficient implementation of struct arrays in Julia](https://github.com/JuliaArrays/StructArrays.jl)

For example, I use:

```julia
struct pt
x::Float64
Y::Float64
end

dims = (100,100,100)
A = StructArray{pt}(zeros(dims), zeros(dims))
A_GPU = replace_storage(CuArray, A)

```

The problem is that if I use now

```julia
A_SHARED = CUDA.@cuStaticSharedMem(pt, (4,4,4))

```

the shared array has the wrong memory layout. Is there a way to make CUDA.@cuStaticSharedMem return a StructArray?

Thanks,

A.
