Concrete-python installation on raspberry pi

Can concrete-python be installed in Raspberry Pi with Ubuntu OS?

1 Like

Hello,

Sorry today, we don’t provide ARM images for Linux. If it’s important for you, you might consider filling a feature request here Issues · zama-ai/concrete · GitHub and we’ll add it to our backlog.

Cheers

Thanks a lot for your reply. I truly appreciate the dedication of the development team and understand the complexities involved in managing feature requests, but what is the typical processing time for feature requests? The reason for my inquiry is that I am currently working on a project and am planning to submit it within a specific timeframe. Thanks, again!

1 Like

You can explain your needs in the issue, your due date, the potential impact etc, and we see: we order things depending on internal priorities or possible impacts for our users, and in particular for users in production.

1 Like

And we are open source! so, you can also consider adding it yourself, if you’re a developer. We even have a grant program, to reward external developers who add great new features. See GitHub - zama-ai/bounty-and-grant-program: Zama Bounty Program and Grant Program: Contribute to the FHE space and Zama's open source libraries and get rewarded 💰

1 Like

Thanks a lot!
Linux on any x86-64 CPU is supported or some specific CPUs only? I want to implement a machine learning algorithm using Concrete-Python on embedded platform.

You need a not-too-old CPU, eg to have AES instructions. You also need the machine where FHE computations will be done to be quite powerful, for executions not to be too long.

What kind of model do you plan to implement?

I am looking to implement a Deep Neural Network to classify EEG signals.

For DL, you’ll definitively need to run on powerful FHE servers. What you can do is to develop in so-called “simulate” mode [see the doc :)], and then when you’ll deploy, you go to a powerful server

Sure, I’ll look into it. Thanks a lot, again!

@benoit - I am interested in getting concrete-python running on the raspberry pi architecture. Do you have the high level steps needed to attempt to compile this as it sounds like a challenge to keep be busy. I have created some simple working code already to test concrete with python.

(https://www.linkedin.com/posts/davidedwards1_fhe-brokers-insurers-activity-7173688498036707328-mJ-D?utm_source=share&utm_medium=member_desktop)

I would be happy to give it a go and see if I can make the needed changes as I find them but just looking where to start and what the steps needed are. If successful would contribute it to the project.

It would be for the raspberry pi 5 with has AES instructions. One further question, if it is running in a client server deployment, does the client need the compiler?

Thanks

Dave

@DaveCT you should follow the README in the concrete-python directory to recompile all from the sources.

The client is part of the concrete package and it cannot be separate from the rest of the concrete-compiler library, but it might be separated technically for example to reduce the client package size, it is not separated for now just for convenience .

Thanks, will start here :slight_smile:

I have managed to get it to compile without errors, takes a long time on a pi 5 (had to leave it running overnight a couple of times to fix a few compiler errors ) it needed some extra dependancies along with some extra swap space (Needed 8GB physical + 2GB swap to compile) and some extra bits on rust. Once everything is confirmed OK will re-do the build and share the script that works.

When I run the final tests I am not sure how to read the results (See below). Overall it says 14 failed and 2222 passed so sounds like it might be good? Any advice would really help here.

Thanks

---------- coverage: platform linux, python 3.11.2-final-0 -----------
---------------------- coverage: failed workers ----------------------
The following workers failed to return coverage data, ensure that pytest-cov is installed on these workers.
gw2
gw0
gw1
gw6
gw7
gw8
gw3
gw4
gw11
gw10
gw9
gw14
gw15
Name Stmts Miss Cover Missing

concrete/fhe/compilation/artifacts.py 82 59 28% 32-39, 50-51, 69, 83-89, 100, 110, 119-193
concrete/fhe/compilation/circuit.py 155 4 97% 60, 66, 99, 202
concrete/fhe/compilation/client.py 59 13 78% 48-56, 78-83, 99
concrete/fhe/compilation/compiler.py 226 81 64% 119-131, 139-151, 182-183, 188-189, 204-206, 222, 244-251, 262-277, 283, 288-293, 302, 354-377, 501-511, 519, 526-531, 538-543, 550-555, 562-567, 574-575, 587, 590-591, 597-622
concrete/fhe/compilation/configuration.py 401 125 69% 38-48, 64-74, 258-271, 392-393, 399-400, 421-462, 572-588, 606-618, 636-692, 736-752, 767-772, 787-801, 859-872, 1248, 1250-1256, 1266-1272, 1276-1277, 1280-1281
concrete/fhe/compilation/decorators.py 45 3 93% 47, 57-62
concrete/fhe/compilation/keys.py 65 32 51% 52, 96-103, 114-128, 147-154, 167-172, 188-195
concrete/fhe/compilation/server.py 251 85 66% 130, 197, 240-273, 290-319, 344-345, 357-358, 361-362, 383-384, 391, 398, 405, 412, 419, 426, 433, 449, 458, 469, 478, 491, 500, 511, 520, 533, 542, 553, 562, 575, 584, 595, 604, 617, 626, 637, 646, 659, 668, 679, 688, 701, 710, 721, 730, 743-781
concrete/fhe/compilation/specs.py 12 3 75% 40, 56-57
concrete/fhe/compilation/utils.py 287 118 59% 43-65, 87-88, 93-94, 97, 117-118, 145-150, 206, 223-227, 233, 290-307, 358-388, 407-438, 466-503, 646-664, 704, 708-720, 818-819, 826-830, 841-854
concrete/fhe/compilation/value.py 10 2 80% 31, 47
concrete/fhe/dtypes/float.py 13 3 77% 19-23, 31
concrete/fhe/dtypes/utils.py 38 1 97% 49
concrete/fhe/extensions/array.py 23 15 35% 31-58
concrete/fhe/extensions/bits.py 76 62 18% 29, 32-144, 160
concrete/fhe/extensions/convolution.py 168 148 12% 80-186, 224-256, 291-323, 358-391, 421-444, 478-534, 563, 592, 621, 655-687
concrete/fhe/extensions/hint.py 13 9 31% 44-56
concrete/fhe/extensions/identity.py 9 4 56% 28-37
concrete/fhe/extensions/maxpool.py 104 86 17% 120-272, 283-308, 321-340
concrete/fhe/extensions/multivariate.py 35 27 23% 37-106
concrete/fhe/extensions/ones.py 16 8 50% 29-43, 56, 73
concrete/fhe/extensions/round_bit_pattern.py 111 14 87% 57-61, 117-118, 132, 147-155, 236-241
concrete/fhe/extensions/table.py 67 19 72% 43, 56-57, 60, 67-68, 72-79, 118, 123-124, 129-137
concrete/fhe/extensions/tag.py 10 4 60% 20-24
concrete/fhe/extensions/truncate_bit_pattern.py 105 75 29% 34-37, 55-69, 79-137, 146, 161-169, 206-255
concrete/fhe/extensions/univariate.py 27 3 89% 60-61, 75
concrete/fhe/extensions/zeros.py 16 8 50% 29-43, 56, 73
concrete/fhe/mlir/context.py 1392 593 57% 97, 179, 205, 253, 312-331, 360, 433, 444, 738, 1041-1102, 1160-1163, 1213-1232, 1308-1327, 1343, 1424-1527, 1534-1541, 1562-1567, 1593-1624, 1635-1707, 1728-1866, 1874, 1882, 1890, 1894-1898, 1903-1911, 1935-1969, 2010-2052, 2066-2071, 2076-2097, 2100, 2107-2135, 2143-2170, 2173-2177, 2189-2193, 2204, 2226, 2273, 2287-2316, 2324-2439, 2459-2483, 2504-2575, 2585-2603, 2658-2697, 2707-2725, 2775-2780, 2785-2806, 2829-2846, 2865-2919, 2933-2936, 2945-2948, 2951-2966, 2974, 2977-2988, 3048, 3192-3196, 3299, 3306, 3326-3517, 3523-3528, 3560-3564, 3570, 3579, 3619-3623, 3630-3639, 3642-3651, 3659-3660, 3719, 3748-3765, 3791-3840
concrete/fhe/mlir/conversion.py 105 4 96% 85-88
concrete/fhe/mlir/converter.py 399 156 61% 109-116, 136-174, 252-253, 256-257, 265-270, 273-278, 281-286, 289-290, 293, 304, 308-309, 321, 325-326, 333-334, 342, 345-346, 349-350, 358, 366, 369-370, 373-374, 381-392, 400, 408, 411-412, 420, 423, 427-428, 437, 446, 453-454, 457-462, 465-466, 477-488, 538-547, 620-633, 642-658, 681-695, 698-702, 715-726, 746-747, 758-759, 767-768, 775-776, 779-780, 783-784
concrete/fhe/mlir/processors/assign_bit_widths.py 240 37 85% 83, 97-98, 191, 198, 282, 288-318, 321-345
concrete/fhe/mlir/processors/check_integer_only.py 7 1 86% 19
concrete/fhe/mlir/processors/process_rounding.py 101 33 67% 43-45, 106-155
concrete/fhe/mlir/utils.py 146 59 60% 40, 43, 46, 96-139, 162, 201-208, 215-229, 239, 258-261, 316-343
concrete/fhe/representation/evaluator.py 20 1 95% 52
concrete/fhe/representation/graph.py 299 107 64% 190-191, 232-338, 387, 418, 440, 451, 503, 507, 534-536, 541-555, 568-574, 585-612, 679-681, 772, 825-828, 834, 895-908, 941-964, 991-1000
concrete/fhe/representation/node.py 165 13 92% 178, 322-326, 329, 437-441, 456
concrete/fhe/representation/utils.py 33 4 88% 84, 100, 128, 131
concrete/fhe/tracing/tracer.py 388 153 61% 90, 99-107, 183, 188-189, 206, 374-375, 380-383, 386-387, 390-391, 395, 402-403, 415-416, 429-433, 455-456, 466-468, 480-482, 484-486, 511, 514, 520, 526, 529, 532, 535, 538, 541, 544, 547, 550-559, 562, 565, 568, 571, 574, 577, 580, 583, 586, 589, 592, 614, 626-643, 646-650, 654, 669-670, 672-673, 678-679, 695, 704, 730, 737-740, 754-834, 841-886, 894, 902, 910, 918, 921-925
concrete/fhe/tracing/typing.py 279 4 99% 1204, 1208, 1215, 1221
concrete/fhe/values/value_description.py 60 12 80% 58, 61, 66-69, 84-95, 110, 157

TOTAL 6213 2188 65%

18 files skipped due to complete coverage.

FAIL Required test coverage of 95% not reached. Total coverage: 64.78%
=========================== short test summary info ============================
FAILED tests/execution/test_shift.py::test_shift[operation23-6-2-lhs_shape23-rhs_shape23-two-tlu-bigger-promoted-smaller-casted]
FAILED tests/execution/test_shift.py::test_shift[operation18-6-2-lhs_shape18-rhs_shape18-two-tlu-bigger-promoted-smaller-casted]
FAILED tests/execution/test_bitwise.py::test_bitwise[operation53-5-4-lhs_shape53-rhs_shape53-two-tlu-bigger-casted-smaller-promoted]
FAILED tests/execution/test_mul.py::test_mul[parameters20-x * y]
FAILED tests/execution/test_shift.py::test_shift[operation22-6-2-lhs_shape22-rhs_shape22-two-tlu-bigger-casted-smaller-promoted]
FAILED tests/compilation/test_circuit.py::test_circuit_draw - ValueError: Pro…
FAILED tests/compilation/test_circuit.py::test_dataflow_circuit
FAILED tests/execution/test_round_bit_pattern.py::test_round_bit_pattern_approximate_off_by_one_errors[9-3-True-conf2]
FAILED tests/execution/test_bitwise.py::test_bitwise[operation31-5-5-lhs_shape31-rhs_shape31-three-tlu-casted]
FAILED tests/compilation/test_circuit.py::test_client_server_api_crt
FAILED tests/execution/test_shift.py::test_shift[operation21-5-2-lhs_shape21-rhs_shape21-chunked]
FAILED tests/execution/test_bitwise.py::test_bitwise[operation29-5-4-lhs_shape29-rhs_shape29-one-tlu-promoted]
FAILED tests/execution/test_round_bit_pattern.py::test_overflowing_round_bit_pattern_with_lsbs_to_remove_of_one
FAILED tests/execution/test_bitwise.py::test_bitwise[operation51-4-4-lhs_shape51-rhs_shape51-three-tlu-casted]
================ 14 failed, 2222 passed in 14422.44s (4:00:22) =================
make: *** [Makefile:45: pytest-default] Error 1

Could you share the full test log? We need to see the errors what happened. Also, it’s possible for the device to run out of memory which leads to workers crashing, which would result in test failure.

Looking forward to see the log.
Thanks!

Here is the link to the logs:
https://www.dropbox.com/scl/fi/htgk35tteycxwu1zwcma6/nohup.out?rlkey=qp87rcvdxxdboecxsvqvqap13&dl=0

Thanks

Will also run again with increased swap size (8GB + 8GB). It takes about 4hrs to run.

Most of the errors come from:

________________________ tests/execution/test_shift.py _________________________
[gw1] linux -- Python 3.11.2 /home/pi/newbuild2/concrete/frontends/concrete-python/.venv/bin/python
worker 'gw1' crashed while running 'tests/execution/test_shift.py::test_shift[operation21-6-2-lhs_shape21-rhs_shape21-chunked]'
______________________ tests/compilation/test_circuit.py _______________________
[gw5] linux -- Python 3.11.2 /home/pi/newbuild2/concrete/frontends/concrete-python/.venv/bin/python
worker 'gw5' crashed while running 'tests/compilation/test_circuit.py::test_dataflow_circuit'
__________________ tests/execution/test_round_bit_pattern.py ___________________
[gw4] linux -- Python 3.11.2 /home/pi/newbuild2/concrete/frontends/concrete-python/.venv/bin/python
worker 'gw4' crashed while running 'tests/execution/test_round_bit_pattern.py::test_overflowing_round_bit_pattern_with_lsbs_to_remove_of_one'
_______________________ tests/execution/test_bitwise.py ________________________
[gw6] linux -- Python 3.11.2 /home/pi/newbuild2/concrete/frontends/concrete-python/.venv/bin/python
worker 'gw6' crashed while running 'tests/execution/test_bitwise.py::test_bitwise[operation50-5-5-lhs_shape50-rhs_shape50-two-tlu-bigger-promoted-smaller-casted]'
_______________________ tests/execution/test_bitwise.py ________________________
[gw7] linux -- Python 3.11.2 /home/pi/newbuild2/concrete/frontends/concrete-python/.venv/bin/python
worker 'gw7' crashed while running 'tests/execution/test_bitwise.py::test_bitwise[operation48-5-5-lhs_shape48-rhs_shape48-two-tlu-bigger-promoted-smaller-casted]'
__________________ tests/execution/test_round_bit_pattern.py ___________________
[gw2] linux -- Python 3.11.2 /home/pi/newbuild2/concrete/frontends/concrete-python/.venv/bin/python
worker 'gw2' crashed while running 'tests/execution/test_round_bit_pattern.py::test_round_bit_pattern_approximate_off_by_one_errors[9-3-True-conf2]'
______________________ tests/compilation/test_circuit.py _______________________
[gw9] linux -- Python 3.11.2 /home/pi/newbuild2/concrete/frontends/concrete-python/.venv/bin/python
worker 'gw9' crashed while running 'tests/compilation/test_circuit.py::test_client_server_api_crt'
________________________ tests/execution/test_matmul.py ________________________
[gw10] linux -- Python 3.11.2 /home/pi/newbuild2/concrete/frontends/concrete-python/.venv/bin/python
worker 'gw10' crashed while running 'tests/execution/test_matmul.py::test_matmul[lhs_shape8-rhs_shape8-bounds8]'
________________________ tests/execution/test_shift.py _________________________
[gw8] linux -- Python 3.11.2 /home/pi/newbuild2/concrete/frontends/concrete-python/.venv/bin/python
worker 'gw8' crashed while running 'tests/execution/test_shift.py::test_shift[operation22-6-2-lhs_shape22-rhs_shape22-two-tlu-bigger-casted-smaller-promoted]'
_________________________ tests/execution/test_mul.py __________________________
[gw13] linux -- Python 3.11.2 /home/pi/newbuild2/concrete/frontends/concrete-python/.venv/bin/python
worker 'gw13' crashed while running 'tests/execution/test_mul.py::test_mul[parameters20-x * y]'
________________________ tests/execution/test_matmul.py ________________________
[gw11] linux -- Python 3.11.2 /home/pi/newbuild2/concrete/frontends/concrete-python/.venv/bin/python
worker 'gw11' crashed while running 'tests/execution/test_matmul.py::test_matmul[lhs_shape1-rhs_shape1-bounds1]'
________________________ tests/execution/test_shift.py _________________________
[gw15] linux -- Python 3.11.2 /home/pi/newbuild2/concrete/frontends/concrete-python/.venv/bin/python
worker 'gw15' crashed while running 'tests/execution/test_shift.py::test_shift[operation23-6-2-lhs_shape23-rhs_shape23-two-tlu-bigger-promoted-smaller-casted]'
________________________ tests/execution/test_shift.py _________________________
[gw16] linux -- Python 3.11.2 /home/pi/newbuild2/concrete/frontends/concrete-python/.venv/bin/python
worker 'gw16' crashed while running 'tests/execution/test_shift.py::test_shift[operation20-5-2-lhs_shape20-rhs_shape20-one-tlu-promoted]'

One could be coming from Python version difference maybe:

E         - Evaluation of generic 'unknown' node resulted in [1, (), 3] of type list which is not acceptable either because of the type or because of overflow
E         + Evaluation of generic 'unknown' node resulted in array([1, (), 3], dtype=object) of type np.ndarray and of underlying type 'dtype[object_]' which is not acceptable because of the underlying type

One comes from the fact that you don’t have graphviz installed in the system:

E           ValueError: Program dot not found in path.

So the main issue is with crashes it seems. Could you try with more swap space maybe? Or you can try to run the test with a single thread, or a couple of thread?

1 Like

Thanks very much, will take a look and see if I can get it working based on this. Will let. you know how it goes.

1 Like

Increasing the swap from 2GB to 8GB managed to reduce the number of failures from 17 down to 9 but still getting some crashes in the log. I had started that test run before I saw the advice on the errors. I have now set it to just use single thread in the Makefile pytest tests -svv -n1 \ instead of pytest tests -svv -n auto \ along with installing graphviz. I expect this will take some time to complete the test run as by adding the swap increases alone the time to complete increased by 2hrs on auto setting… Hopefully will have an update tomorrow. Thanks for the support.