How to properly pass structs into GPU? (MWE included)

Could you explain to me how one would do that? I am not aware of how to change the “CuArrays from within a struct”. I thought immutable meant I had to use a special package like Setfield to do it

EDIT: I think I got it! Basically I was trying to change an immutable struct, but instead I can change the mutable container it holds, in this case the array, using .=.

Link with more info: Julia: How much can we change the objects in immutable struct type? - Stack Overflow


Okay, that is a good take away! In my case I wish to save the intermediate results as well (since I will be using them in other places), but for cases where I don’t need to I will try merging everything into one operation.

Thank you for your answer