-
Notifications
You must be signed in to change notification settings - Fork 20
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
StaticArrays #159
Comments
HI Simon, Thanks for inviting me to comment. Let me start by saying I've been using FixedSizeArrays for a while, and it has been quite suitable and fast and I really have appreciated all the effort you put into it! So as a simple list, the complaints I had and things I was interested in overcoming are:
To conclude, perhaps I should explain that when I started Given how things are now, I'm not sure what should be done? To me the major, long-term "organizational" goal should be to move these out of our personal accounts and have some JuliaX github page (like JuliaStats, JuliaBio, etc, but where X ≈ FastStaticallySizedArrayPackages). It would also be most efficient if we could start collaborating together. Anyway, thanks again for starting this discussion and do let me know your thoughts :) |
Good benchmarks will be very useful no matter what happens in the future, so this is great :) |
Hi Simon, thanks for starting the conversation, we definitely need to sort this out as fragmentation is happening - we now have three(!) different fixed size packages (counting A bit of back story - as of a few months ago, I was slowly fixing the various problems with To summarize some frustrations I've had with
In general, the code has/had a fair bit of one-off patching to make things work with a small set of sizes or given types, without working in the general case. I think this is ok for graphics work because of the small number of shapes and types you typically use, but these things bite you all the time if you're doing general computation with FixedSizeArrays. Especially with funny types like Duals etc, and larger matrix sizes. I already fixed a lot of the type promotion problems, but I still find missing methods now and then. Btw, some possibly useful contributor statistics on current number of lines:
@mschauer any thoughts? You're the next biggest contributor. |
Thanks a lot, seems like reasonable concerns! Let me get familiar with StaticArrays codebase and procure the benchmarks! To get familiar, I could see how easy it'd be to integrate First thing striking me when looking over the code is, that there seem to be a few unnecessary staged functions ;) |
By the way, StructsOfArray(RGB, red, green, blue) # I think this actually already works... Benchmark results ( 7-element BenchmarkTools.BenchmarkGroup:
("vecvec",mean,3,Int64) => TrialJudgement(-32.69% => improvement)
("vecvec",mean,3,Float64) => TrialJudgement(-16.07% => improvement)
("vecvec",-,10,Int32) => TrialJudgement(-8.97% => improvement)
("vecvec",mean,3,Int32) => TrialJudgement(-23.08% => improvement)
("vecvec",-,3,Float64) => TrialJudgement(-9.44% => improvement)
("vecvec",sum,3,Int32) => TrialJudgement(+17.65% => regression)
("vecvec",sum,3,Float32) => TrialJudgement(+10.87% => regression) More improvements than regressions... That's not too bad :) |
On that note, I think a future fixed size array type should be part of the stdlib, whenever that eventuates: it's a pretty core abstraction for geometric computation, among other things, and the correct choice of concrete fixed array container type should eventually be entirely obvious for users. |
I think the inheritance from AbstractArray and mutable fallbacks are killer features. To be honest, in my new code I've switched entirely to StaticArrays, and I've not regretted it yet. One could base I'm also mulling over adding |
I'd like to reply to everything but sorry for this mega-post! @SimonDanisch said:
Using @SimonDanisch Your description of the way forward sounds somewhat similar to dropping the FixedSizeArrays codebase and continuing from the StaticArrays code - is that right? The reason I would advocate for this is (as @c42f mentions) the shear number of API changes is overwhelming. It would take several rounds of deprecations in FixedSizeArrays, and IMHO it might be conceptually easier for users to transition to a new package. If the API of StaticArrays is close enough to
That would be really cool! My limited knowledge is this: LLVM already SIMDs the immutable containers (but does an even better job with
Yes, it is an artifact - an artifact of Julia! Inference is not allowed to "approximate" (or "widen") the input types to a function since the generator could perform arbitrary logic depending on these types. This can also happen for return types, hence everything is also inlined. Standard functions do not always handle static arrays with large numbers of elements smoothly (I honestly can't predict when it works and when it doesn't!) since it can result in
If these were done, then I would think we're in a good place to bring static arrays to the standard library, as @c42f says. Incidentally, this would also eliminate all the generated functions in TypedTables (assuming @timholy said:
The mutable static arrays are more than fallbacks - I've found them also extremely useful on there own. They are faster than
@timholy You could kind-of solve this problem with
LOL. Yes I realized I was being more specific than strictly necessary, but there seemed to be enough complication to begin with :) |
Yeah I meant the last part of that ;)
Well but in the cited line, the generated function is not needed at all, is it? |
If anyone has a proof of that I'm all for simplifying it! (please!) |
To clarify, I think the apparent need for this was what Andy was referring to in his big post above, in the section containing
That is, having |
Nope, only complicated cases that scared me sufficiently that I became paranoid! :) I did of course try to make a minimal test case at a few points, but couldn't pin down the problems (simple stuff mostly works). This is something that needs to be researched further (or we ask Jeff or someone to explain the specifics). Any help here is greatly appreciated. Simplifying the code is definitely a goal, but not at the cost of abandoning performant, large static arrays. There's even a chain of |
Oh I see, so my ignorance then ;) |
Unfortunately it's necessary that inference makes approximations. Inference will work it's way through e.g. recursive function calls, and if you make a mistake and your code is non-terminating, compilation would be toast. Currently you run the code and quickly get a stack-overflow error and a simplified traceback. What I've suggested to Jeff Bezanson & co. is that we might want a |
Getting back to the original issue, where are we here? |
I'm pretty set on switching to StaticArrays. Just need some time to play around with it and do the switch! |
OK, great, thanks Simon. It will be great to have you on board. I think we should now try decide where to put StaticArrays more centrally. |
...with another 10000 planned 😄. Sure, I'd be happy to deposit a lot of stuff in some org. |
done! ;) |
Can I be an owner, please? I can't create a repo and transfer it... |
I'd be for the squares :) Sorry, didn't realize I invited you only as members! Should be fixed. |
I took the liberty to chose the icon... We can of course change it! ;) |
Thanks Simon! Ah, too bad that github decides to resize it, I'll try a 100px version of the same. Gotta get the important things right - someone else may have decided the color of the bikeshed, but we get to decide how many doors. By the way, github makes all organization members private by default, and as far as I know it's up to members to make themselves public. So you may want to do that :-) |
I moved StaticArrays over now. You should each be invited for admin access. |
Squares are definitely better :) |
Great! Thanks everyone :) |
OK, now StaticArrays looks less lonely over at JuliaArrays. |
Yikes, that's a whole bunch of array packages :-) |
Can we move ImmutableArrays to JuliaArrays? There are a few packages that use ImmutableArrays that can use some updates as well. |
Well, I didn't move |
I think it might make make sense to move If we also release a new 0.5-only version of both these packages, and depwarn a prominent part of their interfaces with a message which recommends StaticArrays, that would really encourage migration: people using 0.5 would see the depwarn, but people on older julia versions would be able to continue using the older packages without fuss. A few Speaking of which, I rather liked writing |
I kinda agree that the packages could be amalgamated at JuliaArrays with prominent plans for the future advertised.
Make an issue there, and we can try hash it out. I guess my main issue is that I knew I would have arbitrary dimension arrays ( |
I forgot to mention: ArrayFire.jl has |
As far as I know, |
+1 for moving |
I'll put this here - I made a relavant announcement about StaticArrays on julia-users https://groups.google.com/forum/#!topic/julia-users/wxtAnqk3FWk |
I think there should be only one package for fixed size arrays ;)
Of course I'm a bit biased towards FixedSizeArrays, since I'm more familiar with the code :D
@andyferris @c42f, could you explain to me what would speak for StaticArrays?
What were the initial motivations behind it?
Right now the biggest things seem to be inheritance from DenseArray and already up to dateness with 0.5.
These could be brought to FixedSizeArrays with a rewrite.
I'm trying to fix up FixedArrayBench with support for StaticArrays to further judge this.
Last time, something wasn't working with 0.5 and BenchmarkTools.jl.
Best,
Simon
The text was updated successfully, but these errors were encountered: