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

Lascar CpaEngine Jit Errors #38

Open
godylockz opened this issue May 10, 2023 · 1 comment
Open

Lascar CpaEngine Jit Errors #38

godylockz opened this issue May 10, 2023 · 1 comment

Comments

@godylockz
Copy link

Hello!

Was using lascar to perform CPA analysis; however, the jit functionality of the CpaEngine was breaking.
Here is the debug output if interested:
Wanted to report this just in case anyone else runs into this problem in the meantime!

cpa_engines = [lascar.CpaEngine(name="cpa_%02d" % i, selection_function=generate_selection_function(i), guess_range=range(256), jit=False) for i in range(BLOCK_SIZE)]
During: resolving callee type: type(CPUDispatcher(<function generate_selection_function.<locals>.selection_with_guess at 0x7f7cd7ce1c60>))
During: typing of call at /usr/local/lib/python3.11/dist-packages/lascar/engine/guess_engine.py (74)


File "../../../../usr/local/lib/python3.11/dist-packages/lascar/engine/guess_engine.py", line 74:
            def hf(guessrange, batchvalues):
                <source elided>
                    for guess in np.arange(guessrange.shape[0]):
                        out[d, guess] = f(batchvalues[d], guessrange[guess])
                        ^

/usr/local/lib/python3.11/dist-packages/lascar/engine/cpa_engine.py:78: RuntimeWarning: invalid value encountered in divide
  numerator = (self._accXM / self._number_of_processed_traces) - np.outer(
/usr/local/lib/python3.11/dist-packages/lascar/engine/cpa_engine.py:79: RuntimeWarning: invalid value encountered in divide
  self._accM / self._number_of_processed_traces, m
/usr/local/lib/python3.11/dist-packages/lascar/engine/cpa_engine.py:83: RuntimeWarning: invalid value encountered in divide
  self._accM2 / self._number_of_processed_traces
/usr/local/lib/python3.11/dist-packages/lascar/engine/cpa_engine.py:84: RuntimeWarning: invalid value encountered in divide
  - (self._accM / self._number_of_processed_traces) ** 2,
@yhql
Copy link
Collaborator

yhql commented Jan 17, 2024

Hello, these kind of errors are usually due to the selection_function using types for input or output that cannot be infered from the python function, or are unsupported by numba. Perhaps (if you still have it, we haven't been quick to answer that one...) you could post the content of your generate_selection_function to find out?

The actual JIT error is usually pretty hard to find in the huge log of errors that pops when that happens though... The one you posted only shows were it happened, and the last part is a RuntimeWarning, not an error

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