Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use StructArrays.jl #40

Open
MasonProtter opened this issue Mar 6, 2020 · 3 comments
Open

use StructArrays.jl #40

MasonProtter opened this issue Mar 6, 2020 · 3 comments

Comments

@MasonProtter
Copy link
Contributor

Your currently just have

aos_to_soa(x) = x

I feel like it might be worth it to just add a dependancy on StructArrays.jl, which imo should really be a baked in part of Julia's array interface.

@ChrisRackauckas
Copy link
Member

Does that work with Tracker?

@MasonProtter
Copy link
Contributor Author

MasonProtter commented Mar 6, 2020

Hm, no it appears to not work with it at least out of the box:

julia> using Tracker

julia> v = rand(10) |> param
Tracked 10-element Array{Float64,1}:
 0.19747042290556305
 0.3577805915969372
 0.41164333584420354
 0.07956973618070462
 0.3882813140794923
 0.030429901869670095
 0.13329838162061325
 0.3263069803112133
 0.32484677886198
 0.37871805455668994

julia> using StructArrays

julia> StructArray(v)
0-element StructArray() with eltype Float64 with indices 1:0

I wonder if we just need to pirate in the right constructor though. I don't really know anything about Tracker.

Alternatively, we could just define the default to be aos_to_soa(x) = StructArray(x) and then use some custom implementation that doesn't use StructArray for Tracker.

I don't have any stakes in this, just a random thought, so feel free to ignore if this isn't the direction you're interested.

@ChrisRackauckas
Copy link
Member

Yeah maybe it's a better default than doing nothing. But I'd like to keep this pretty much dependency free. StructArrays seems to leak to some weird data stuff...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants