-
-
Notifications
You must be signed in to change notification settings - Fork 482
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
Caching of data needed for computations in k_dual #14228
Comments
comment:1
Attachment: trac_14288-partition_caches.patch.gz |
Dependencies: #13605 |
Attachment: trac_14228-partition_caches.patch.gz Disregard the first patch, it has a wrong ticket number. |
This comment has been minimized.
This comment has been minimized.
comment:2
Sorry for the "wrong" patch name. Apply trac_14228-partition_caches.patch |
comment:3
I'm wondering how much of a speedup we'd get if we made
So we alternatively want to make a new partitions parent specifically for this which just wraps the iterator given by I also restructured it slightly by creating an abstract base class for the actual bases for easier maintenance. Anyways, I've attached my patch. |
Changed author from Simon King to Simon King Travis Scrimshaw |
comment:4
There is one hunk of my patch that only applies with #14225. Hence, new dependency. |
comment:5
Wow. You made a major restructuring of code. It will be difficult to merge the two approaches. |
comment:6
There was one failing doctest in the first version of my patch. Because of the structural changes, the error thrown is changed (although it fundamentally is the same error). |
comment:7
Replying to @simon-king-jena:
The big thing that I did was pulled out the common code for the bases into an ABC. It looks scarier than it is. I also avoided calling I can handle the merging. |
comment:8
Arrgh. I tried to post this twice, but trac didn't accept because you posted too. A minute later, trac didn't seem to accept posts at all. Let's try again. Some timings:
Unfortunately, our two patches are incompatible. How to get the best of both worlds? |
comment:9
Replying to @tscrim:
Great, thank you. Looking at your patch, it seems that your code includes parts of the changes that I suggested (but differently in the case of the Weyl group), and I think other parts of my code (namely the cached method _Partitions) make sense to be used in your patch, too. |
comment:10
I'll let you know what happens some of my other possible speedups as well. Expect something within a few hours. |
comment:11
Okay, I've merged the patches (I didn't incorperate the Weyl group) and made Here's some data. Without patch (with #14225):
With:
Edit - I still have not been able to see the approx 2x speedup that you got with just your patch, so I'm still doing something relatively slow... |
Changed author from Simon King Travis Scrimshaw to Simon King, Travis Scrimshaw |
comment:12
Replying to @tscrim:
I suppose that's why...
It would probably be bad to have a global cache. That's why in my patch I suggested to have the cache local to the parent that uses the data. In that way, the data can still be garbage collected (it is not a global cache!), as soon as the parent using the data is done. It seems to me that we will not get up to speed, unless we cache the few partitions that are local to these k-bounded thingies. |
comment:13
Your patch seems to perform quite well:
with
Let's see if caching the few permutations gives us yet some more speed. |
comment:14
Question about your merged patch: In partition.py, you've put a cached_method in front of one of the two young_subgroup methods and one of the two young_soubgroup_generator methods. Was that intended? I thought it would be better to keep a pointer to the resulting permutation groups, not to some lists. |
comment:15
I tried with the cached method in the parent as well and got approximately the same timings:
Hmm...strange we're getting such different timings. I'm running
I thought that's what your patch did. Whoops! I'll change it on the next version. There's still a few more things I want to try. |
comment:16
Did you do tests with your patch? I get errors such as
Hence, it seems that IntegerListsLex should have a |
comment:17
I just did them and removed the |
comment:18
Okay, I also added a little micro-optimization by explicitly calling the |
This comment has been minimized.
This comment has been minimized.
comment:19
With the patch that you posted last, I get
Additionally using a local cache for Partitions or Weyl group gives no further improvement. So, I suggest we use the merged patch as basis for a our reviews. Is it cross review? Does this patch contain my code? |
comment:20
I believe only the cached method on |
Reviewer: Simon King |
Changed author from Simon King, Travis Scrimshaw to Travis Scrimshaw |
comment:21
OK. So, I am supposed to review it, then. |
comment:22
The change to
For the patchbot: Apply trac_14228-sym_speedup-ts.patch |
comment:24
PS: According to the traceback of this error, it uses the hash of |
comment:25
I'll implement a custom hash for it and fix those attribute errors shortly. |
Fixed doctests |
comment:26
Attachment: trac_14228-sym_speedup-ts.patch.gz Sorry that took so long. I went out for dinner in between. I fixed the doctests in |
comment:27
I also forgot: For patchbot: Apply: trac_14228-sym_speedup-ts.patch |
comment:28
It seems that the coverage script is complaining. Indeed, You now define a hash for I reckon that one should do
and not
I think it is documented somewhere that My plan is to add a reviewer patch, removing the custom hash and bringing |
Attachment: trac_14228-reviewer.patch.gz |
This comment has been minimized.
This comment has been minimized.
comment:30
I added a reviewer patch, as I indicated in my previous post. Hope you agree with my changes. I will finish the review as soon as all tests pass. Apply trac_14228-sym_speedup-ts.patch trac_14228-reviewer.patch |
comment:33
Looks good to me too. Thank you Simon. Best, Travis |
Merged: sage-5.8.beta4 |
#12313 brought a severe slow-down to sage.combinat.sf.k_dual. The purpose of task #13991 is to mitigate this. The purpose of this ticket is to deal with one aspect of the slow-down.
Certain data of partitions should be cached, namely
WeylGroup
and the Young subgroup. And sage.combinat.sf.k_dual constructs a couple of partitions, but they are only weakly cached, so that they eventually are created repeatedly. Hence, they should be cached, too.Apply
Depends on #13605
Depends on #14225
CC: @sagetrac-sage-combinat @tscrim @nthiery @nbruin @zabrocki
Component: combinatorics
Author: Travis Scrimshaw
Reviewer: Simon King
Merged: sage-5.8.beta4
Issue created by migration from https://trac.sagemath.org/ticket/14228
The text was updated successfully, but these errors were encountered: