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

Kernel crashes when I run the following code #62

Closed
MahmoudMohajer opened this issue Mar 16, 2023 · 9 comments
Closed

Kernel crashes when I run the following code #62

MahmoudMohajer opened this issue Mar 16, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@MahmoudMohajer
Copy link

MahmoudMohajer commented Mar 16, 2023

Summary

I ran the following code in jupyter notebook related to Linear regression tutorial with concrete-ml and kernel crashes each time I run this code.
fhe_circuit.client.keygen(force=False)

Description

  • versions affected:0.6.1
  • python version:3.9.16
  • OS:Linux mint una

Step by step procedure someone should follow to trigger the bug:

just run all the cells in jupyter notebook of linear regression with concrete-ml.

@MahmoudMohajer MahmoudMohajer added the bug Something isn't working label Mar 16, 2023
@RomanBredehoft
Copy link
Collaborator

Hello,
Great to know that you are trying out Concrete-ML !

It's a bit hard to know what could be the issue here, the notebook works fine on our side. Could you give us more information on the configuration you're using (for example, by running the top command) ?

Also, what Concrete-Numpy and Concrete-Compiler are you currently using ? You can run pip show concrete-numpy and pip show concrete-compiler.

Thanks !

@MahmoudMohajer
Copy link
Author

$pip show concrete-compiler
Name: concrete-compiler
Version: 0.23.4
Summary: Concrete Compiler
Home-page: https://github.com/zama-ai/concrete-compiler
Author: Zama Team
Author-email: hello@zama.ai
License: BSD-3
Location: /home/mahmoud/anaconda3/envs/fhe/lib/python3.9/site-packages
Requires: numpy, PyYAML, setuptools
Required-by: concrete-numpy
(fhe) ~$pip show concrete-numpy
Name: concrete-numpy
Version: 0.9.0
Summary: Concrete Numpy is an open-source library which simplifies the use of fully homomorphic encryption (FHE).
Home-page: https://zama.ai/concrete/
Author: Zama
Author-email: hello@zama.ai
License: BSD-3-Clause
Location: /home/mahmoud/anaconda3/envs/fhe/lib/python3.9/site-packages
Requires: concrete-compiler, matplotlib, networkx, numpy, Pillow, torch
Required-by: concrete-ml

@RomanBredehoft
Copy link
Collaborator

Thanks ! These dependencies look good. Maybe you can give us more information on the configuration you're using then (for example, by running top ?

@MahmoudMohajer
Copy link
Author

I have 10GB ram
Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz

@RomanBredehoft
Copy link
Collaborator

Could you now try to put the following code in a .py file and then run it (using the same environment you're using) :

from sklearn.model_selection import train_test_split
from sklearn.datasets import make_regression
from concrete.ml.sklearn import LinearRegression

X, y = make_regression(
    n_samples=200, n_features=8, n_targets=1, bias=5.0, noise=30.0, random_state=42
)
x_train, x_test, y_train, y_test = train_test_split(X, y, test_size=0.4, random_state=42)

concrete_model = LinearRegression()
concrete_model.fit(x_train, y_train)
circuit = concrete_model.compile(x_train)
circuit.keygen()
y_pred = concrete_model.predict(x_test, execute_in_fhe=True)

Do you encounter the same issue ? If so, could you give me the error/crash's complete traceback ? Thanks !

@MahmoudMohajer
Copy link
Author

shell Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATHto point to it): /home/mahmoud/anaconda3/envs/fhe/lib/python3.9/site-packages/mlir/_mlir_libs/libConcretelangBindingsPythonCAPI.so(+0x10c2821)[0x7f3714bc3821] /home/mahmoud/anaconda3/envs/fhe/lib/python3.9/site-packages/mlir/_mlir_libs/libConcretelangBindingsPythonCAPI.so(+0x10c0024)[0x7f3714bc1024] /lib/x86_64-linux-gnu/libpthread.so.0(+0x14420)[0x7f379e5f0420] /home/mahmoud/anaconda3/envs/fhe/lib/python3.9/site-packages/mlir/_mlir_libs/../../concrete_compiler.libs/libConcretelangRuntime-aaaa6abd.so(+0x23eab9)[0x7f3799dc1ab9] /home/mahmoud/anaconda3/envs/fhe/lib/python3.9/site-packages/mlir/_mlir_libs/../../concrete_compiler.libs/libConcretelangRuntime-aaaa6abd.so(new_default_engine+0x148)[0x7f3799e1f6e8] /home/mahmoud/anaconda3/envs/fhe/lib/python3.9/site-packages/mlir/_mlir_libs/libConcretelangBindingsPythonCAPI.so(_ZN12concretelang9clientlib6KeySet8generateERNS0_16ClientParametersEmm+0x208)[0x7f3718877b98] /home/mahmoud/anaconda3/envs/fhe/lib/python3.9/site-packages/mlir/_mlir_libs/libConcretelangBindingsPythonCAPI.so(_ZN12concretelang9clientlib11KeySetCache8generateESt10shared_ptrIS1_ERNS0_16ClientParametersEmm+0x2e)[0x7f371888605e] /home/mahmoud/anaconda3/envs/fhe/lib/python3.9/site-packages/mlir/_mlir_libs/libConcretelangBindingsPythonCAPI.so(+0xebd13c)[0x7f37149be13c] /home/mahmoud/anaconda3/envs/fhe/lib/python3.9/site-packages/mlir/_mlir_libs/libConcretelangBindingsPythonCAPI.so(_Z7key_setN12concretelang9clientlib16ClientParametersEN4llvm8OptionalINS0_11KeySetCacheEEE+0x50)[0x7f37149d1790] /home/mahmoud/anaconda3/envs/fhe/lib/python3.9/site-packages/mlir/_mlir_libs/_concretelang.cpython-39-x86_64-linux-gnu.so(+0x2feed)[0x7f379a185eed] /home/mahmoud/anaconda3/envs/fhe/lib/python3.9/site-packages/mlir/_mlir_libs/_concretelang.cpython-39-x86_64-linux-gnu.so(+0x1ca12)[0x7f379a172a12] python[0x507507] python(_PyObject_MakeTpCall+0x2ec)[0x4f049c] python(_PyEval_EvalFrameDefault+0x52ab)[0x4ec99b] python[0x4e67ea] python(_PyFunction_Vectorcall+0xd5)[0x4f7be5] python(_PyEval_EvalFrameDefault+0x4d74)[0x4ec464] python[0x4e67ea] python(_PyFunction_Vectorcall+0xd5)[0x4f7be5] python(_PyEval_EvalFrameDefault+0x689)[0x4e7d79] python[0x4e67ea] python(_PyFunction_Vectorcall+0xd5)[0x4f7be5] python(_PyEval_EvalFrameDefault+0x689)[0x4e7d79] python[0x4e67ea] python(_PyEval_EvalCodeWithName+0x47)[0x4e6477] python(PyEval_EvalCodeEx+0x39)[0x4e6429] python(PyEval_EvalCode+0x1b)[0x593ccb] python[0x5c1077] python[0x5bd080] python[0x4564f6] python(PyRun_SimpleFileExFlags+0x1a2)[0x5b6d62] python(Py_RunMain+0x37e)[0x5b42de] python(Py_BytesMain+0x39)[0x587d79] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f379e2b4083] python[0x587c2e] PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Instruction non permise (core dumped)

@RomanBredehoft
Copy link
Collaborator

Thanks a lot, we are currently investigating the issue !

@youben11
Copy link
Member

The issue seems to come from the fact that we rely on aes instructions during keygen, and that your CPU doesn't support that (You can see that in "Security & Reliability). Newer CPUs (starting from 2010 I guess) should support that.

We are currently thinking of checking the availability of such instructions at runtime, and fallback to a software variant if not available. We could potentially support older versions in that case, but for the time being, the fastest solution is to use a CPU that supports aes instructions.

@MahmoudMohajer
Copy link
Author

Thank you for instructions. I will try to upgrade my CPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants