I used to encounter this error when libConcretelangRuntime.so was linked to my system llvm library rather than the one we compile. If you compiled the bindings from the compiler Makefile, the -DLLVM_LINK_LLVM_DYLIB=on line should fix that for you.
Are you building on main ? Are you using the makefile to compile the python bindings ?
I think I need to start again and make sure I am going through the correct process. Goin to take a break and will try again tomorrow. If you have an suggestions in the mean time all this help is greatly appreciated From a high level what is the sequence I should go through from the very beginning?
I have tried to start from the start and have switched to Ubuntu on raspberry pi as opposed to Raspbian. When I run pytest I get a different error but I believe that can be ignored?. The issue is now when I try to install the wheel and the test program I get an LLVM dump. Any suggestions on what I could try next?
Here are the steps I go through for a build:
# Ubuntu Server running on raspberry pi 5 with 8GB memory
# Ubuntu 23.10 (GNU/Linux 6.5.0-1013-raspi aarch64)
# Recommend ubuntu is installed and booted from USB 3 SSD or PICe SSD as the SD card will be very slow.
# Make sure all packages are up to date.
sudo apt update
sudo apt upgrade
# Reboot after this may be needed depending on packages updated.
# Setup Swap as test workers will crash due to not enough memory.
sudo dd if=/dev/zero of=/mnt/8GiB.swap bs=1024 count=8388608
sudo chmod 600 /mnt/8GiB.swap
sudo mkswap /mnt/8GiB.swap
sudo swapon /mnt/8GiB.swap
echo '/mnt/8GiB.swap swap swap defaults 0 0' | sudo tee -a /etc/fstab
# Install packages (screen install optional so can easily detach if removing into Ubuntu)
sudo apt install cmake screen build-essential ninja-build python3-dev ccache python3-pip git python3-venv libboost-all-dev libgoogle-perftools-dev patchelf graphviz graphviz-dev valgrind libssl-dev python-is-python3
# create link for python to python3 so Makefile does not need to be updated to use python3. (Not needed if python-is-python3 is installed).
#sudo ln -s /usr/bin/python3 /usr/bin/python
# install rust - Accept the default.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Logout and log back in again and then get the nightly toolchain
rustup toolchain install nightly-2024-01-31
# may need this if get the error again
# rustup target add aarch64-unknown-linux-gnu --toolchain nightly-2024-01-31
mkdir newbuild
cd new build
git clone https://github.com/zama-ai/concrete.git --recursive
cd concrete
cd frontends/concrete-python
make venv
source .venv/bin/activate
cd ../../compilers/concrete-compiler/compiler
# see if this fixes the dataflow error
export DATAFLOW_EXECUTION_ENABLED=ON
# Run āmake python-bindingsā in background with nohup as can take a few hours to compile, output is stored in nohup.out, tail -f to see progress I.e ātail -f nohup.outā
nohup make python-bindings &
# once complete do the following:
export COMPILER_BUILD_DIRECTORY=$(pwd)/build
echo "export COMPILER_BUILD_DIRECTORY=$(pwd)/build" >> ~/.bashrc
cd ../../../frontends/concrete-python
#edit the Makefile and change the following so number of threads is 1
# pytest tests -svv -n 1 \
make pytest
#Edit the Makefile and change from x86_64 to aarch64 so reads āfor PLATFORM in manylinux_$${GLIBC_VER}_aarch64 linux_aarch64; do \ā
make whl
Here is the failed test:
=================================== FAILURES ===================================
______________________ tests/compilation/test_circuit.py _______________________
[gw0] linux ā Python 3.11.6 /home/pi/newbuild/concrete/frontends/concrete-python/.venv/bin/python
worker āgw0ā crashed while running ātests/compilation/test_circuit.py::test_dataflow_circuitā
=============================== warnings summary ===============================
ā¦/ā¦/compilers/concrete-compiler/compiler/build/tools/concretelang/python_packages/concretelang_core/concrete/init.py:1
ā¦/ā¦/compilers/concrete-compiler/compiler/build/tools/concretelang/python_packages/concretelang_core/concrete/init.py:1
ā¦/ā¦/compilers/concrete-compiler/compiler/build/tools/concretelang/python_packages/concretelang_core/concrete/init.py:1
/home/pi/newbuild/concrete/compilers/concrete-compiler/compiler/build/tools/concretelang/python_packages/concretelang_core/concrete/init.py:1: DeprecationWarning: pkg_resources is deprecated as an API. See Package Discovery and Resource Access using pkg_resources - setuptools 69.2.0.post20240313 documentation import(āpkg_resourcesā).declare_namespace(name)
ā¦/ā¦/compilers/concrete-compiler/compiler/build/tools/concretelang/python_packages/concretelang_core/concrete/init.py:1
ā¦/ā¦/compilers/concrete-compiler/compiler/build/tools/concretelang/python_packages/concretelang_core/concrete/init.py:1
ā¦/ā¦/compilers/concrete-compiler/compiler/build/tools/concretelang/python_packages/concretelang_core/concrete/init.py:1
/home/pi/newbuild/concrete/compilers/concrete-compiler/compiler/build/tools/concretelang/python_packages/concretelang_core/concrete/init.py:1: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('concrete').
Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See Keywords - setuptools 69.2.0.post20240313 documentation import(āpkg_resourcesā).declare_namespace(name)
concrete/init.py:7
concrete/init.py:7
concrete/init.py:7
/home/pi/newbuild/concrete/frontends/concrete-python/concrete/init.py:7: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('concrete').
Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See Keywords - setuptools 69.2.0.post20240313 documentation import(āpkg_resourcesā).declare_namespace(name) # pragma: no cover
---------- coverage: platform linux, python 3.11.6-final-0 -----------
---------------------- coverage: failed workers ----------------------
The following workers failed to return coverage data, ensure that pytest-cov is installed on these workers.
gw0
Name Stmts Miss Cover Missing
FAIL Required test coverage of 95% not reached. Total coverage: 90.63%
=========================== short test summary info ============================
FAILED tests/compilation/test_circuit.py::test_dataflow_circuit
========== 1 failed, 2241 passed, 12 warnings in 20180.25s (5:36:20) ===========
make: *** [Makefile:45: pytest-default] Error 1
Here is the the new error when running the test script
I think it was the same error, but I will just do it again to confirm, I have three raspberry Piās sitting there with the same config trying different options . Have tried a lot of combinations but will confirm in about 3 hrs
Hi Dave,
Itās difficult to tell what is going wrong as the backtrace doesnāt contain all the symbols, but I was wondering if the Pi has sufficient RAM to execute this. Itās just a hunch as this seems to blow within an operation that could be trying to allocate memory.
While itās not necessarily exactly the same, the memory usage of a given test should be in the same ballpark on different machines, so if this test works on another platform that you have, you could measure the high water mark (e.g., using /usr/bin/time -v) and make sure that would comfortably fit within the Piās memory.
Hi, I think i was gettgin further on Raspbian as opposed to Ubuntu.
I now get the following error when running the test script which seems to be much further along:
(venv) pi@pi-fhe3:~ $ python test.py
Compiling...
Traceback (most recent call last):
File "/home/pi/test.py", line 10, in <module>
circuit = compiler.compile(inputset)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/venv/lib/python3.11/site-packages/concrete/fhe/compilation/compiler.py", line 521, in compile
mlir_module = GraphConverter(self.configuration).convert(self.graph, mlir_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/venv/lib/python3.11/site-packages/concrete/fhe/mlir/converter.py", line 129, in convert
return self.convert_many({name: graph}, mlir_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/venv/lib/python3.11/site-packages/concrete/fhe/mlir/converter.py", line 60, in convert_many
self.process(graphs)
File "/home/pi/venv/lib/python3.11/site-packages/concrete/fhe/mlir/converter.py", line 240, in process
processor.apply_many(graphs)
File "/home/pi/venv/lib/python3.11/site-packages/concrete/fhe/mlir/processors/assign_bit_widths.py", line 115, in apply_many
new_bit_width = model[bit_width].as_long()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/venv/lib/python3.11/site-packages/z3/z3.py", line 3023, in as_long
return int(self.as_string())
^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
Could you provide us with test.py content ? Is it a file from the repository, or something you implemented yourself ? Itās hard to tell what goes wrong from this trace only.
So I have been building the python-bindings on my computer (not a raspberry-pi) from main, and running what you sent me does not produce any error ā¦ Do you get the same kind of errors when running the tests ?
Hi, the only error in the test is the orginal one (copied below), all the other tests pass:
tests/compilation/test_circuit.py::test_dataflow_circuit WARNING: The generated random seed is not crypto secure
/home/pi/newbuild3/concrete/frontends/concrete-python/.venv/bin/python: **symbol lookup error: /tmp/tmpyzoeh276/sharedlib.so: undefined symbol: _dfr_register_work_function**