JuliaORNL / JACC.jl

CPU/GPU parallel performance portable layer in Julia via functions as arguments
MIT License
21 stars 13 forks source link

Struct of arrays #51

Open PhilipFackler opened 7 months ago

PhilipFackler commented 7 months ago

(or any user-defined type). If the type of each member of a struct can be passed to a parallel_for, I should also be able to pass a struct of such types. This came up because I wanted to use something like this:

mutable struct Q
    h::JACC.Array{Float64,1}
    k::JACC.Array{Float64,1}
    l::JACC.Array{Float64,1}
    w::JACC.Array{Float64,1}
end

and pass an instance of this to a parallel_for. This is fine with the "threads" backend, but CUDA complains that this struct is not isbits.

williamfgc commented 7 months ago

Thanks @PhilipFackler, from our discussion would you post the structure that worked that got passed to parallel_for? Tuple?

PhilipFackler commented 7 months ago

mwe_tuple.txt mwe_struct.txt

The struct version does not work. The tuple version works.