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

Make "large multiplication" larger in coerce_actions.pyx #36789

Merged
merged 2 commits into from
Jan 14, 2024

Conversation

jhpalmieri
Copy link
Member

A doctest in coerce_actions.pyx tests whether "large multiplications can be interrupted". Depending on the random input and on the speed of the machine, that multiplication can happen too fast, and then the interrupt doesn't happen in time. So let's make the multiplication take longer.

This should fix #35973.

In some testing: this multiplication uses P = E.random_element() where E is some elliptic curve. If this happens to be (0:1:0), then on at least one machine, the multiplication is completed too quickly. We could reject that particular point, or we can increase the multiplication by a factor of 10. This PR uses the second approach.

📝 Checklist

  • The title is concise, informative, and self-explanatory.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

⌛ Dependencies

@jhpalmieri
Copy link
Member Author

I see a failure on one machine, as reported at #35973. If you want a fake way to reproduce it, weaken the test: change sage: alarm(0.001); 2^(10^7) * P to something like sage: alarm(0.001); 2^(10^4) * P.

@tscrim
Copy link
Collaborator

tscrim commented Dec 20, 2023

Why not just make the P explicit instead of random here?

@jhpalmieri
Copy link
Member Author

Why not just make the P explicit instead of random here?

I don't know why it was written that way originally. See #17844, which doesn't provide any explanation for the role of the randomness.

@tscrim
Copy link
Collaborator

tscrim commented Dec 20, 2023

I think we should also just make that element explicit as there isn't really any reason to test on a random element.

@jhpalmieri
Copy link
Member Author

Hi Travis, I'm taking a break from Sage for a while. If you want to make the relevant changes, I could review them, but I am not able to do more right now.

@tscrim
Copy link
Collaborator

tscrim commented Dec 27, 2023

No problem. Unfortunately with GH I can't push to your branch (without doing something complicated like as a PR to your branch). It can just wait until you are back from your (Sage?) vacation.

@mkoeppe
Copy link
Member

mkoeppe commented Dec 28, 2023

@tscrim Now you should have the necessary privileges

@tscrim tscrim force-pushed the enlarge-large-multiplication branch from d1bf25f to aa02c4a Compare December 28, 2023 03:43
@tscrim
Copy link
Collaborator

tscrim commented Dec 28, 2023

@mkoeppe Thank you. @jhpalmieri I added my change.

If someone else could just quickly double-check my change, then this is a positive review.

Copy link

Documentation preview for this PR (built with commit aa02c4a; changes) is ready! 🎉

@mkoeppe
Copy link
Member

mkoeppe commented Dec 30, 2023

Marking as blocker so that it fixes the sporadic doctest failure, just seen again in https://github.com/sagemath/sage/actions/runs/7360378714/job/20036434575?pr=36938#step:11:9298

vbraun pushed a commit to vbraun/sage that referenced this pull request Jan 2, 2024
…s.pyx

    
A doctest in coerce_actions.pyx tests whether "large multiplications can
be interrupted". Depending on the random input and on the speed of the
machine, that multiplication can happen too fast, and then the interrupt
doesn't happen in time. So let's make the multiplication take longer.

<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->

This should fix sagemath#35973.

In some testing: this multiplication uses `P = E.random_element()` where
`E` is some elliptic curve. If this happens to be `(0:1:0)`, then on at
least one machine, the multiplication is completed too quickly. We could
reject that particular point, or we can increase the multiplication by a
factor of 10. This PR uses the second approach.

<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [X] The title is concise, informative, and self-explanatory.
- [X] The description explains in detail what this PR is about.
- [X] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36789
Reported by: John H. Palmieri
Reviewer(s):
vbraun pushed a commit to vbraun/sage that referenced this pull request Jan 5, 2024
…s.pyx

    
A doctest in coerce_actions.pyx tests whether "large multiplications can
be interrupted". Depending on the random input and on the speed of the
machine, that multiplication can happen too fast, and then the interrupt
doesn't happen in time. So let's make the multiplication take longer.

<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->

This should fix sagemath#35973.

In some testing: this multiplication uses `P = E.random_element()` where
`E` is some elliptic curve. If this happens to be `(0:1:0)`, then on at
least one machine, the multiplication is completed too quickly. We could
reject that particular point, or we can increase the multiplication by a
factor of 10. This PR uses the second approach.

<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [X] The title is concise, informative, and self-explanatory.
- [X] The description explains in detail what this PR is about.
- [X] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36789
Reported by: John H. Palmieri
Reviewer(s):
@vbraun vbraun merged commit 3e8006f into sagemath:develop Jan 14, 2024
21 checks passed
@mkoeppe mkoeppe added this to the sage-10.3 milestone Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Random doctest failure in structure/coerce_actions.pyx
4 participants