You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the MWE below to replace the storage with CuArray data types. It looks like replace_storage recognizes CuArray out of CuArray{Float32} but ignores the Float32 part. Did I miss something? Thanks for your help!
using CUDA
using StructArrays
foo =StructArray(a=[1.0for i =1:10])
bar1 =replace_storage(CuArray, foo) # defaults to CuArray{Float64}@showtypeof(bar1)
bar2 =replace_storage(CuArray{Float32}, foo) # still yields CuArray{Float64}
bar3 =convert(CuArray{Float32}, foo.a) # works fine
The text was updated successfully, but these errors were encountered:
The docstring of replace_storage mentions that the eltype of the output is expected to be the same. The reason is that for complex types (not NamedTuple types but custom structs), it is a bit difficult to figure out what the output eltype should be. Basically, one would need a method createtype(T, type_1, type_2, ..., type_n) that computes the updated eltype based on column types rather than column values (this could be added to the interface).
If you have a StructArray of NamedTuple, you could instead use
julia> foo =StructArray(a=[1.0for i =1:3]);
julia>StructArray(map(Array{Float32}, StructArrays.components(foo)))
3-element StructArray(::Vector{Float32}) with eltype NamedTuple{(:a,), Tuple{Float32}}:
(a =1.0,)
(a =1.0,)
(a =1.0,)
Hi,
I have the MWE below to replace the storage with CuArray data types. It looks like
replace_storage
recognizesCuArray
out ofCuArray{Float32}
but ignores theFloat32
part. Did I miss something? Thanks for your help!The text was updated successfully, but these errors were encountered: