-
Notifications
You must be signed in to change notification settings - Fork 175
FIX/ENHANCE: ImageKernelBlockHomomorphism memory and performance #2025
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2025 +/- ##
==========================================
+ Coverage 66.02% 66.02% +<.01%
==========================================
Files 898 898
Lines 273285 273311 +26
Branches 12773 12773
==========================================
+ Hits 180429 180456 +27
+ Misses 90035 90033 -2
- Partials 2821 2822 +1
|
4fe5de0 to
f0b2db5
Compare
| img:=D[orb[j]][1]^k; | ||
| p:=PositionProperty(D,x->img in x); | ||
| if p=fail then Error("block are not well");fi; | ||
| if not p in orb then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is yet another ad-hoc orbit algo implementation.
Are the orbits going to be very short? If not, wouldn't it make more sense to use a dictionary here, instead of letting GAP perform a linear search through orb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about dictionaries, but it is an orbit on blocks, and I'm always mapping just one point (and then find the block containing the point).
[Just realize that I should be able to remove PositionProperty and instead use the stored inverse list -- will do so to make the code better though practical effect will probably be neglegible.]
As for length, the orbit is at most of length |D|, but the condition requires that the permutation degree |B|*|D| is at least |D|^3, that is the orbit is at most third root of permutation degree.
(Thomas' example that triggered is was degree 150k and action on 9 blocks of size 17k each, this change sped up a calculation including other tasks by a factor of 10)
What might be good is to be more careful still with `AddGenerators', but at this point before a release I don't want to do tricky business whose function is not completely clear.
fingolfin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some nitpicks on the commit structure, and one on code formatting, but all in all this seems to be a clear improvement.
Oh, of course a test case would be great, too, but I am guessing it is difficult to provide one.
| ## | ||
| InstallMethod( KernelOfMultiplicativeGeneralMapping,"blocks homomorphism", | ||
| true, | ||
| [ IsBlocksHomomorphism ], 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the first commit in this PR moves this method around (why), and also changes its rank to 200. The second commit changes the rank back to 0. Neither commit mentions any of this, though. What's going on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the first and third commit kind of are invisible because the code they touch is completely rewritten by the other commits. All in all, perhaps this PR should be squashed into a single commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The moving was to have the kernel method near the function that does the work. The ranking change was debugging code that should not have survived, and then was kicked out. I thought I had this commit already rebased away.
(Part of the reason for the multi-commits was to synchronize work and home.)
Anyhow, I can squash it all together before merging.
lib/ghomperm.gi
Outdated
| while j<=Length(orb) do | ||
| for k in S.generators do | ||
| img:=D[orb[j]][1]^k; | ||
| p:=hom!.reps[img]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please avoid using tabs for indentation in this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are a hello from my editor. I'll fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PS: Is there a problem if I simply replace all tabs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hulpke I would recommend to replace ALL tabs only in separate commits (not necessarily in this PR). Otherwise, diffs will be very lengthy and it will be VERY hard to review this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alex-konovalov
The tab changes make up less than 1/3 of the overall PR, but I kept it a separate commit so it can be thrown out again.
|
@fingolfin |
|
@hulpke 2-minutes long example which is tested as part of this PR sounds OK with me. We can move it to testextra, to remove from Travis tests, later, but for now this will allow to test it in several settings, what's very useful. |
The old code added every generator found with `AddGeneratorsExtendSchreierTree'. This caused the storage of lots of generators and subsequent memory issues. Also, if there are few large blocks, Butler's block homomorphism code is inefficient and it needs to run through all points in one block. In this case an ordinary orbit calculation is far more efficient. Together these issues did cause severe problems in large degrees with few blocks (observed by Thomas). It it possible that it also rectifies some of the observed problems in larger degree. What one could still do is to use random subproducts instead of testing all Schreier generators, but this is not the right time to do so.
|
@alex-konovalov |
|
I've assigned this to GAP 4.9.1 milestone. @hulpke you will need to edit the PR so that it will be submitted to stable-4.9 branch (see https://github.com/blog/2224-change-the-base-branch-of-a-pull-request ) |
|
@hulpke could it be that because of that now when all packages are loaded I am observing this: |
|
Was this merged intentionally?!? |
|
@hulpke I am afraid that there is no evidence that c509e8b passes the tests. As I have said above, I was asking for "2-minutes long example which is tested as part of this PR" and tests in textextra are not, because of resource limitations. I have a way to test critical PRs in Jenkins before merging, so it would be useful to let me know that this PR has been updated and tests added, so that I will be able to check. |
|
@hulpke also, note that |
|
@fingolfin Yes, it was merged intentionally (before @alex-konovalov sent his last bunch of remarks)
So what now: |
|
Dear @alex-konovalov
Do you want to say it does not pass, or is the issue genuinely that of evidence? It would be helpful to have in an obvious place (say the etc directory) a description of what tests are supposed to pass and with what parameters (memory, assertion level etc.) If you want to run tests yourself before any merge let me know and how I should request this -- I had send you a message on this page after adding the test that it had been built in. I have tested grpauto.tst, on my machine. It runs (with minimum packages) in under 1 GB with assertions turned on. I also tested Finally, about the tests: This is (as will be future changes, e.g. for socle) an issue that can only happen in large degree (100k+), implying not only that it runs for longer but also that such an example needs to be built in first place to avoid having to put thousands of lines with permutations in the test file, taking time for construction. As I know that travis is time critical I put the extra test in in testextra, as it is a relatively straightforward code in the library it is unlikely to need the various different system architectures. So, let me know what you would want me to do and I will try to do so. |
|
@hulpke what I meant was that while commit message at c509e8b says "merged now as all tests work fine ...", the new test has been added to I will write more about tests later. In principle, it's easy to run |
|
@hulpke just to clarify: I don't think there is need to unmerge it (at least not urgently -- I am hopeful this can simply be resolved via some additional tweaks) . Nor did I mean to imply that merging this was bad, sorry for my bad wording. I simply was surprised that it was merged suddenly, because just before I noticed that I saw that PR against stable-4.9 with the same (?) content. |
|
This night's run is a bit different: teststandard passes on linux and fails on mac. Incidentally, new Semigroups release fails to build on LInux (semigroups/Semigroups#431). Could this be related, @james-d-mitchell ? |
|
With this PR being closed, I think I'll move discussion to #2035 (which is so far the same commit) |
|
OK, then I've changed milestone for this issue from 4.9.1 to 4.10.0, while #2035 has correct 4.9.1 milestone. |
|
Added "not for release notes" label since I expect #2035 to be listed in release notes for 4.9.1. |
in ImageKernelBlockHomomorphism do not add superfluous generators.
This otherwise can cause bad memory problems in large degrees with few
blocks (observed by Thomas).
Also if there are few large blocks, use orbit on blocks, together with test for redundant Schreier generators, rather than running through all points in block.