Closed Sameeksha0709 closed 5 days ago
@Sameeksha0709 see the Importing section in the documentation
Hi i followed the same but still getting the error
@Sameeksha0709 can you share a github repo so that we can see what's happening ?
Hi i am working on RPI4. this will work for rpi4?
What is RPI4 ?
Raspeberry Pi-4
for the features try
--features=aarch64-unix,integer
it should compile
if it does not then we need to see what code you have
Hi I am getting this error now
cargo run --features aarch64-unix,integer
Finished dev
profile [unoptimized + debuginfo] target(s) in 0.09s
Running target/debug/my_tfhe_project
thread 'main' panicked at /home/pi2/.cargo/registry/src/index.crates.io-6f17d22bba15001f/concrete-csprng-0.4.0/src/generators/implem/aarch64/block_cipher.rs:26:13:
The ArmAesBlockCipher requires both aes and neon aarch64 CPU features.
aes feature available: false
neon feature available: true
.
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
//My code is
use tfhe::{ConfigBuilder, generate_keys, set_server_key, FheUint8};
use tfhe::prelude::*;
fn main() { let config = ConfigBuilder::default().build();
// Client-side
let (client_key, server_key) = generate_keys(config);
let clear_a = 27u8;
let clear_b = 128u8;
let a = FheUint8::encrypt(clear_a, &client_key);
let b = FheUint8::encrypt(clear_b, &client_key);
// Server-side
set_server_key(server_key);
let result = a + b;
// Client-side
let decrypted_result: u8 = result.decrypt(&client_key);
let clear_result = clear_a + clear_b;
assert_eq!(decrypted_result, clear_result);
}
@Sameeksha0709 then use
--features=seeder_unix,integer
~/my_tfhe_project $
pi2@raspberrypi:~/my_tfhe_project $ cargo run --features seeder_unix,integer
Finished dev
profile [unoptimized + debuginfo] target(s) in 0.11s
Running target/debug/my_tfhe_project
thread 'main' panicked at /home/pi2/.cargo/registry/src/index.crates.io-6f17d22bba15001f/concrete-csprng-0.4.0/src/generators/implem/aarch64/block_cipher.rs:26:13:
The ArmAesBlockCipher requires both aes and neon aarch64 CPU features.
aes feature available: false
neon feature available: true
.
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
still getting same error
ok, we likely have a bug then, let me check
however do note that running on a raspberry pi 4 is likley going to be very, very, very slow
sorry in your Cargo.toml
you must have:
tfhe = { ..., features = ["seeder_unix", "integer"] }
you can remove the features from your cargo run
Thanks It's working now
HI can you tell me why running on rpi is slow for TFHE-rs while with open-fhe library it's not that much slow
make sure you compile and run with --release
@Sameeksha0709 were you able to solve the performance problem with the --release
suggestion ?
Hi, it's working fine. Can I use this library for writing code in C programming?
I am more comfortable with c
You have a C API binding for the HL API.
We do not recommend using it because of the ffi transition it adds vs. writing rust code.
See https://docs.zama.ai/tfhe-rs/guides/c_api
If you build the C API you will need to adapt the features as we discussed in this issue.
I'll mark the issue as resolved as the original problem has been fixed.
If you have other questions don't hesitate to open another issue.
Cheers
HI while i am building the example code i am getting the below error
unresolved import
tfhe::prelude
--> src/main.rs:1:11 | 1 | use tfhe::prelude::*; | ^^^^^^^ could not findprelude
intfhe
tfhe::generate_keys
,tfhe::set_server_key
,tfhe::ConfigBuilder
,tfhe::FheUint32
,tfhe::FheUint8
--> src/main.rs:2:12FheUint8
in the rootFheUint32
in the rootConfigBuilder
in the rootset_server_key
in the rootgenerate_keys
in the rootFor more information about this error, try
rustc --explain E0432
. error: could not compilemy_tfhe_project
(bin "my_tfhe_project") due to 2 previous error