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

Crash and error for specific values of q #114

Open
jdumezy opened this issue May 22, 2024 · 1 comment
Open

Crash and error for specific values of q #114

jdumezy opened this issue May 22, 2024 · 1 comment

Comments

@jdumezy
Copy link

jdumezy commented May 22, 2024

Description
When using the rough LWE estimator for set n and distributions, there is a specific range of value of q for which either python crashes or it outputs an error.

How I encountered the problem
In a fresh session of sage (after importing the estimator with from estimator import *), I can run the following estimations with no problem:

sage: params = LWE.Parameters(n=2^14, q=2^180, Xs = ND.Uniform(-1,1,n), Xe=ND.DiscreteGaussian(3.19))
sage: LWE.estimate.rough(params)
expected result
sage: params = LWE.Parameters(n=2^14, q=2^280, Xs = ND.Uniform(-1,1,n), Xe=ND.DiscreteGaussian(3.19))
sage: LWE.estimate.rough(params)
expected result

But for values between 2^180 and 2^280 there is unexpected behavior.
Either an error and some results:

sage: params = LWE.Parameters(n=2^14, q=2^240, Xs = ND.Uniform(-1,1,n), Xe=ND.DiscreteGaussian(3.19))
sage: LWE.estimate.rough(params)
Algorithm functools.partial(<estimator.lwe_dual.MATZOV object at 0x743d85bb9e80>, red_cost_model=<estimator.reduction.ADPS16 object at 0x743d860cb830>) on LWEParameters(n=16384, q=1766847064778384329583297500742918515827483896875618958121606201292619776, Xs=D(σ=0.82), Xe=D(σ=3.19), m=+Infinity, tag=None) failed with Calling ceil() on infinity or NaN
usvp                 :: rop: ≈2^218.4, red: ≈2^218.4, δ: 1.002540, β: 748, d: 31817, tag: usvp
{'usvp': rop: ≈2^218.4, red: ≈2^218.4, δ: 1.002540, β: 748, d: 31817, tag: usvp}

Or a crash for values around 260:

sage: params = LWE.Parameters(n=2^14, q=2^250, Xs = ND.Uniform(-1,1,n), Xe=ND.DiscreteGaussian(3.19))
sage: LWE.estimate.rough(params)
sig_error() without sig_on()
...
(very long crash log)
------------------------------------------------------------------------
Unhandled SIGABRT: An abort() occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
[1]    23531 IOT instruction (core dumped)  sage

OS/specs
I am running sage 10.3 (python 3.12.3) on linux with a 13th gen i9 and 32Gb of RAM.

Is this "expected" (wrong choice of parameters?) or isolated behavior? Thanks.

@ludopulles
Copy link
Contributor

FYI I can't reproduce this error on SageMath 10.4, Python 3.12.5 and commit 1e58f02 :

Note: you call Uniform(-1, 1, n) but n is not assigned any value in the example you give.

sage: from estimator import *
sage: params = LWE.Parameters(n=2^14, q=2^240, Xs = ND.Uniform(-1,1), Xe=ND.DiscreteGaussian(3.19))
sage: LWE.estimate.rough(params)
usvp                 :: rop: ≈2^218.4, red: ≈2^218.4, δ: 1.002540, β: 748, d: 31817, tag: usvp
dual_hybrid          :: rop: ≈2^217.5, red: ≈2^217.5, guess: ≈2^164.1, β: 745, p: 3, ζ: 0, t: 90, β': 745, N: ≈2^153.6, m: ≈2^14.0
{'usvp': rop: ≈2^218.4, red: ≈2^218.4, δ: 1.002540, β: 748, d: 31817, tag: usvp,
 'dual_hybrid': rop: ≈2^217.5, red: ≈2^217.5, guess: ≈2^164.1, β: 745, p: 3, ζ: 0, t: 90, β': 745, N: ≈2^153.6, m: ≈2^14.0}
sage: params = LWE.Parameters(n=2^14, q=2^250, Xs = ND.Uniform(-1,1), Xe=ND.DiscreteGaussian(3.19))
sage: LWE.estimate.rough(params)
usvp                 :: rop: ≈2^206.7, red: ≈2^206.7, δ: 1.002645, β: 708, d: 31862, tag: usvp
dual_hybrid          :: rop: ≈2^205.7, red: ≈2^205.6, guess: ≈2^202.3, β: 704, p: 3, ζ: 20, t: 90, β': 704, N: ≈2^146.0, m: ≈2^14.0
{'usvp': rop: ≈2^206.7, red: ≈2^206.7, δ: 1.002645, β: 708, d: 31862, tag: usvp,
 'dual_hybrid': rop: ≈2^205.7, red: ≈2^205.6, guess: ≈2^202.3, β: 704, p: 3, ζ: 20, t: 90, β': 704, N: ≈2^146.0, m: ≈2^14.0}

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