Mixing GPU/CPU in struct definition

Yes, that is probably best, as too many type parameters are bad (e.g. really annoying in error messages). You can use something like this to avoid repetition:

julia> for (n,V) in zip([:CPUstuct, :GPUstruct], [:Vector, :CuVector])
       eval(quote
       struct $n
       a::$V{StaticArrays.SVector{3,Float64}}
       c::$V{StaticArrays.SVector{20,Float64}}
       end
       end
       )
       end

(untested)

1 Like