chore(bench): revert print bench id

This reverts commit ef07963767.
This commit is contained in:
Mayeul@Zama
2025-11-14 15:33:19 +01:00
committed by mayeul-zama
parent 1568f7c532
commit f9268b889f
23 changed files with 14 additions and 200 deletions

View File

@@ -51,37 +51,30 @@ fn benches(c: &mut Criterion, params: BooleanParameters, parameter_name: &str) {
let ct3 = cks.encrypt(true);
let id = format!("AND::{parameter_name}");
println!("{id}");
bench_group.bench_function(&id, |b| b.iter(|| black_box(sks.and(&ct1, &ct2))));
write_to_json_boolean(&id, params, parameter_name, "and");
let id = format!("NAND::{parameter_name}");
println!("{id}");
bench_group.bench_function(&id, |b| b.iter(|| black_box(sks.nand(&ct1, &ct2))));
write_to_json_boolean(&id, params, parameter_name, "nand");
let id = format!("OR::{parameter_name}");
println!("{id}");
bench_group.bench_function(&id, |b| b.iter(|| black_box(sks.or(&ct1, &ct2))));
write_to_json_boolean(&id, params, parameter_name, "or");
let id = format!("XOR::{parameter_name}");
println!("{id}");
bench_group.bench_function(&id, |b| b.iter(|| black_box(sks.xor(&ct1, &ct2))));
write_to_json_boolean(&id, params, parameter_name, "xor");
let id = format!("XNOR::{parameter_name}");
println!("{id}");
bench_group.bench_function(&id, |b| b.iter(|| black_box(sks.xnor(&ct1, &ct2))));
write_to_json_boolean(&id, params, parameter_name, "xnor");
let id = format!("NOT::{parameter_name}");
println!("{id}");
bench_group.bench_function(&id, |b| b.iter(|| black_box(sks.not(&ct1))));
write_to_json_boolean(&id, params, parameter_name, "not");
let id = format!("MUX::{parameter_name}");
println!("{id}");
bench_group.bench_function(&id, |b| b.iter(|| black_box(sks.mux(&ct1, &ct2, &ct3))));
write_to_json_boolean(&id, params, parameter_name, "mux");
}

View File

@@ -73,7 +73,6 @@ fn keyswitch<Scalar: UnsignedTorus + CastInto<usize> + Serialize>(
);
bench_id = format!("{bench_name}::{name}");
println!("{bench_id}");
{
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
@@ -85,7 +84,6 @@ fn keyswitch<Scalar: UnsignedTorus + CastInto<usize> + Serialize>(
}
BenchmarkType::Throughput => {
bench_id = format!("{bench_name}::throughput::{name}");
println!("{bench_id}");
let blocks: usize = 1;
let elements = throughput_num_threads(blocks, 1); // FIXME This number of element do not staturate the target machine
bench_group.throughput(Throughput::Elements(elements));
@@ -233,7 +231,6 @@ fn packing_keyswitch<Scalar, F>(
);
bench_id = format!("{bench_name}::{name}");
println!("{bench_id}");
{
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
@@ -245,7 +242,6 @@ fn packing_keyswitch<Scalar, F>(
}
BenchmarkType::Throughput => {
bench_id = format!("{bench_name}::throughput::{name}");
println!("{bench_id}");
let blocks: usize = 1;
let elements = throughput_num_threads(blocks, 1);
bench_group.throughput(Throughput::Elements(elements));
@@ -418,7 +414,6 @@ mod cuda {
let cuda_indexes = CudaIndexes::new(&h_indexes, &streams, 0);
bench_id = format!("{bench_name}::{name}");
println!("{bench_id}");
{
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
@@ -440,7 +435,6 @@ mod cuda {
let gpu_count = get_number_of_gpus() as usize;
bench_id = format!("{bench_name}::throughput::{name}");
println!("{bench_id}");
let blocks: usize = 1;
let elements = throughput_num_threads(blocks, 1);
let elements_per_stream = elements as usize / gpu_count;
@@ -650,7 +644,6 @@ mod cuda {
streams.synchronize();
bench_id = format!("{bench_name}::{name}");
println!("{bench_id}");
{
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
@@ -670,7 +663,6 @@ mod cuda {
let gpu_count = get_number_of_gpus() as usize;
bench_id = format!("{bench_name}::throughput::{name}");
println!("{bench_id}");
let mem_size = get_packing_keyswitch_list_64_size_on_gpu(
&CudaStreams::new_single_gpu(GpuIndex::new(0)),

View File

@@ -111,7 +111,6 @@ fn ks_pbs<Scalar: UnsignedTorus + CastInto<usize> + Serialize>(
);
bench_id = format!("{bench_name}::{name}");
println!("{bench_id}");
{
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
@@ -135,7 +134,6 @@ fn ks_pbs<Scalar: UnsignedTorus + CastInto<usize> + Serialize>(
}
BenchmarkType::Throughput => {
bench_id = format!("{bench_name}::throughput::{name}");
println!("{bench_id}");
let blocks: usize = 1;
let elements = throughput_num_threads(blocks, 1);
println!("Number of elements: {elements}"); // DEBUG
@@ -372,7 +370,6 @@ fn multi_bit_ks_pbs<
);
bench_id = format!("{bench_name}::{name}::parallelized");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
keyswitch_lwe_ciphertext(
@@ -394,7 +391,6 @@ fn multi_bit_ks_pbs<
}
BenchmarkType::Throughput => {
bench_id = format!("{bench_name}::throughput::{name}");
println!("{bench_id}");
let blocks: usize = 1;
let elements = throughput_num_threads(blocks, 1);
println!("Number of elements: {elements}"); // DEBUG
@@ -625,7 +621,6 @@ mod cuda {
let cuda_indexes = CudaIndexes::new(&h_indexes, &streams, 0);
bench_id = format!("{bench_name}::{name}");
println!("{bench_id}");
{
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
@@ -657,7 +652,6 @@ mod cuda {
let gpu_count = get_number_of_gpus() as usize;
bench_id = format!("{bench_name}::throughput::{name}");
println!("{bench_id}");
let blocks: usize = 1;
let elements = throughput_num_threads(blocks, 1);
let elements_per_stream = elements as usize / gpu_count;
@@ -935,7 +929,6 @@ mod cuda {
let cuda_indexes = CudaIndexes::new(&h_indexes, &streams, 0);
bench_id = format!("{bench_name}::{name}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
cuda_keyswitch_lwe_ciphertext(
@@ -965,7 +958,6 @@ mod cuda {
let gpu_count = get_number_of_gpus() as usize;
bench_id = format!("{bench_name}::throughput::{name}");
println!("{bench_id}");
let blocks: usize = 1;
let elements = throughput_num_threads(blocks, 1);
let elements_per_stream = elements as usize / gpu_count;

View File

@@ -62,7 +62,6 @@ fn modulus_switch_noise_reduction(c: &mut Criterion) {
.measurement_time(std::time::Duration::from_secs(5));
let bench_name = format!("modulus_switch_noise_reduction_{count}");
println!("{bench_name}");
bench_group.bench_function(&bench_name, |b| {
b.iter(|| {

View File

@@ -296,7 +296,6 @@ mod cuda {
CudaLweCiphertextList::from_lwe_ciphertext(&out_pbs_ct, &streams);
bench_id = format!("{bench_name}::{params_name}");
println!("{bench_id}");
{
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
@@ -318,7 +317,6 @@ mod cuda {
let gpu_count = get_number_of_gpus() as usize;
bench_id = format!("{bench_name}::throughput::{params_name}");
println!("{bench_id}");
let blocks: usize = 1;
let elements = throughput_num_threads(blocks, 1);
let elements_per_stream = elements as usize / gpu_count;
@@ -543,7 +541,6 @@ mod cuda {
let cuda_indexes = CudaIndexes::new(&h_indexes, &streams, 0);
bench_id = format!("{bench_name}::{params_name}");
println!("{bench_id}");
{
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
@@ -567,7 +564,6 @@ mod cuda {
let gpu_count = get_number_of_gpus() as usize;
bench_id = format!("{bench_name}::throughput::{params_name}");
println!("{bench_id}");
let blocks: usize = 1;
let elements = throughput_num_threads(blocks, 1);
let elements_per_stream = elements as usize / gpu_count;

View File

@@ -97,7 +97,6 @@ fn mem_optimized_pbs<Scalar: UnsignedTorus + CastInto<usize> + Serialize>(
);
bench_id = format!("{bench_name}::{name}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
@@ -115,7 +114,6 @@ fn mem_optimized_pbs<Scalar: UnsignedTorus + CastInto<usize> + Serialize>(
}
BenchmarkType::Throughput => {
bench_id = format!("{bench_name}::throughput::{name}");
println!("{bench_id}");
let blocks: usize = 1;
let elements = throughput_num_threads(blocks, 1);
bench_group.throughput(Throughput::Elements(elements));
@@ -328,7 +326,6 @@ fn mem_optimized_batched_pbs<Scalar: UnsignedTorus + CastInto<usize> + Serialize
);
bench_id = format!("{bench_name}::{name}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
batch_programmable_bootstrap_lwe_ciphertext_mem_optimized(
@@ -345,7 +342,6 @@ fn mem_optimized_batched_pbs<Scalar: UnsignedTorus + CastInto<usize> + Serialize
}
BenchmarkType::Throughput => {
bench_id = format!("{bench_name}::throughput::{name}");
println!("{bench_id}");
let blocks: usize = 1;
let elements = throughput_num_threads(blocks, 1);
bench_group.throughput(Throughput::Elements(elements));
@@ -556,7 +552,6 @@ fn multi_bit_pbs<
);
bench_id = format!("{bench_name}::{name}::parallelized");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
multi_bit_programmable_bootstrap_lwe_ciphertext(
@@ -573,7 +568,6 @@ fn multi_bit_pbs<
}
BenchmarkType::Throughput => {
bench_id = format!("{bench_name}::throughput::{name}");
println!("{bench_id}");
let blocks: usize = 1;
let elements = throughput_num_threads(blocks, 1);
bench_group.throughput(Throughput::Elements(elements));
@@ -785,7 +779,6 @@ fn mem_optimized_pbs_ntt(c: &mut Criterion) {
buffers.resize(stack_size);
bench_id = format!("{bench_name}::{name}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
programmable_bootstrap_ntt64_lwe_ciphertext_mem_optimized(
@@ -802,7 +795,6 @@ fn mem_optimized_pbs_ntt(c: &mut Criterion) {
}
BenchmarkType::Throughput => {
bench_id = format!("{bench_name}::throughput::{name}");
println!("{bench_id}");
let blocks: usize = 1;
let elements = throughput_num_threads(blocks, 1);
bench_group.throughput(Throughput::Elements(elements));
@@ -1028,7 +1020,6 @@ mod cuda {
let cuda_indexes = CudaIndexes::new(&h_indexes, &streams, 0);
bench_id = format!("{bench_name}::{name}");
println!("{bench_id}");
{
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
@@ -1052,7 +1043,6 @@ mod cuda {
let gpu_count = get_number_of_gpus() as usize;
bench_id = format!("{bench_name}::throughput::{name}");
println!("{bench_id}");
let blocks: usize = 1;
let elements = throughput_num_threads(blocks, 1);
let elements_per_stream = elements as usize / gpu_count;
@@ -1290,7 +1280,6 @@ mod cuda {
let cuda_indexes = CudaIndexes::new(&h_indexes, &streams, 0);
bench_id = format!("{bench_name}::{name}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
cuda_multi_bit_programmable_bootstrap_lwe_ciphertext(
@@ -1312,7 +1301,6 @@ mod cuda {
let gpu_count = get_number_of_gpus() as usize;
bench_id = format!("{bench_name}::throughput::{name}");
println!("{bench_id}");
let blocks: usize = 1;
let elements = throughput_num_threads(blocks, 1);
let elements_per_stream = elements as usize / gpu_count;

View File

@@ -70,7 +70,6 @@ fn bench_fhe_type<FheType>(
let mut bench_id;
bench_id = format!("{bench_prefix}::add::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let res = &lhs + &rhs;
@@ -81,7 +80,6 @@ fn bench_fhe_type<FheType>(
write_record(bench_id, "add");
bench_id = format!("{bench_prefix}::overflowing_add::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let (res, flag) = lhs.overflowing_add(&rhs);
@@ -92,7 +90,6 @@ fn bench_fhe_type<FheType>(
write_record(bench_id, "overflowing_add");
bench_id = format!("{bench_prefix}::overflowing_sub::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let (res, flag) = lhs.overflowing_sub(&rhs);
@@ -103,7 +100,6 @@ fn bench_fhe_type<FheType>(
write_record(bench_id, "overflowing_sub");
bench_id = format!("{bench_prefix}::sub::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let res = &lhs - &rhs;
@@ -114,7 +110,6 @@ fn bench_fhe_type<FheType>(
write_record(bench_id, "sub");
bench_id = format!("{bench_prefix}::mul::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let res = &lhs * &rhs;
@@ -125,7 +120,6 @@ fn bench_fhe_type<FheType>(
write_record(bench_id, "mul");
bench_id = format!("{bench_prefix}::bitand::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let res = &lhs & &rhs;
@@ -136,7 +130,6 @@ fn bench_fhe_type<FheType>(
write_record(bench_id, "bitand");
bench_id = format!("{bench_prefix}::bitor::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let res = &lhs | &rhs;
@@ -147,7 +140,6 @@ fn bench_fhe_type<FheType>(
write_record(bench_id, "bitor");
bench_id = format!("{bench_prefix}::bitxor::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let res = &lhs ^ &rhs;
@@ -158,7 +150,6 @@ fn bench_fhe_type<FheType>(
write_record(bench_id, "bitxor");
bench_id = format!("{bench_prefix}::left_shift::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let res = &lhs << &rhs;
@@ -169,7 +160,6 @@ fn bench_fhe_type<FheType>(
write_record(bench_id, "left_shift");
bench_id = format!("{bench_prefix}::right_shift::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let res = &lhs >> &rhs;
@@ -180,7 +170,6 @@ fn bench_fhe_type<FheType>(
write_record(bench_id, "right_shift");
bench_id = format!("{bench_prefix}::left_rotate::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let res = (&lhs).rotate_left(&rhs);
@@ -191,7 +180,6 @@ fn bench_fhe_type<FheType>(
write_record(bench_id, "left_rotate");
bench_id = format!("{bench_prefix}::right_rotate::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let res = (&lhs).rotate_right(&rhs);
@@ -202,7 +190,6 @@ fn bench_fhe_type<FheType>(
write_record(bench_id, "right_rotate");
bench_id = format!("{bench_prefix}::min::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let res = lhs.min(&rhs);
@@ -213,7 +200,6 @@ fn bench_fhe_type<FheType>(
write_record(bench_id, "min");
bench_id = format!("{bench_prefix}::max::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let res = lhs.max(&rhs);
@@ -308,14 +294,12 @@ where
let mut kv_store = KVStore::new();
let mut rng = rand::thread_rng();
let format_and_print_bench_id = |op_name: &str| -> String {
let bench_id = format!(
let format_id_bench = |op_name: &str| -> String {
format!(
"KVStore::<{}, {}>::{op_name}/{num_elements}",
TypeDisplayer::<Key>::default(),
TypeDisplayer::<Value>::default(),
);
println!("{bench_id}");
bench_id
)
};
match BenchmarkType::from_env().unwrap() {
@@ -334,19 +318,19 @@ where
let value = rng.gen::<u128>();
let value_to_add = Value::encrypt(value, cks);
c.bench_function(&format_and_print_bench_id("Get"), |b| {
c.bench_function(&format_id_bench("Get"), |b| {
b.iter(|| {
let _ = kv_store.get(&encrypted_key);
})
});
c.bench_function(&format_and_print_bench_id("Update"), |b| {
c.bench_function(&format_id_bench("Update"), |b| {
b.iter(|| {
let _ = kv_store.update(&encrypted_key, &value_to_add);
})
});
c.bench_function(&format_and_print_bench_id("Map"), |b| {
c.bench_function(&format_id_bench("Map"), |b| {
b.iter(|| {
kv_store.map(&encrypted_key, |v| v);
})
@@ -383,7 +367,7 @@ where
let mut group = c.benchmark_group("KVStore Throughput");
group.throughput(Throughput::Elements(kv_stores.len() as u64));
group.bench_function(format_and_print_bench_id("Map"), |b| {
group.bench_function(format_id_bench("Map"), |b| {
b.iter(|| {
kv_stores.par_iter_mut().for_each(|kv_store| {
kv_store.map(&encrypted_key, |v| v);
@@ -391,7 +375,7 @@ where
})
});
group.bench_function(format_and_print_bench_id("Update"), |b| {
group.bench_function(format_id_bench("Update"), |b| {
b.iter(|| {
kv_stores.par_iter_mut().for_each(|kv_store| {
kv_store.update(&encrypted_key, &value_to_add);
@@ -399,7 +383,7 @@ where
})
});
group.bench_function(format_and_print_bench_id("Get"), |b| {
group.bench_function(format_id_bench("Get"), |b| {
b.iter(|| {
kv_stores.par_iter_mut().for_each(|kv_store| {
kv_store.get(&encrypted_key);

View File

@@ -483,7 +483,6 @@ fn bench_swap_request_latency<FheType, F1, F2>(
let params_name = params.name();
let bench_id = format!("{bench_name}::{fn_name}::{type_name}");
println!("{bench_id}");
c.bench_function(&bench_id, |b| {
let mut rng = thread_rng();
@@ -557,7 +556,6 @@ fn bench_swap_request_throughput<FheType, F1, F2>(
let bench_id = format!(
"{bench_name}::throughput::{fn_name}::{params_name}::{type_name}::{num_elems}_elems"
);
println!("{bench_id}");
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
let from_balances_0 = (0..num_elems)
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
@@ -681,7 +679,6 @@ fn cuda_bench_swap_request_throughput<FheType, F1, F2>(
let bench_id = format!(
"{bench_name}::throughput::{fn_name}::{params_name}::{type_name}::{num_elems}_elems"
);
println!("{bench_id}");
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
let from_balances_0 = (0..num_elems)
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
@@ -884,7 +881,6 @@ fn bench_swap_claim_latency<FheType, F1, F2>(
let params_name = params.name();
let bench_id = format!("{bench_name}::{fn_name}::{params_name}::{type_name}");
println!("{bench_id}");
c.bench_function(&bench_id, |b| {
let mut rng = thread_rng();
@@ -964,7 +960,6 @@ fn bench_swap_claim_throughput<FheType, F1, F2>(
let bench_id = format!(
"{bench_name}::throughput::{fn_name}::{params_name}::{type_name}::{num_elems}_elems"
);
println!("{bench_id}");
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
let pending_0_in = (0..num_elems)
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
@@ -1106,7 +1101,6 @@ fn cuda_bench_swap_claim_throughput<FheType, F1, F2>(
let bench_id = format!(
"{bench_name}::throughput::{fn_name}::{params_name}::{type_name}::{num_elems}_elems"
);
println!("{bench_id}");
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
let pending_0_in = (0..num_elems)
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))

View File

@@ -356,7 +356,6 @@ fn bench_transfer_latency<FheType, F>(
let params_name = params.name();
let bench_id = format!("{bench_name}::{fn_name}::{params_name}::{type_name}");
println!("{bench_id}");
c.bench_function(&bench_id, |b| {
let mut rng = thread_rng();
@@ -410,7 +409,6 @@ fn bench_transfer_latency_simd<FheType, F>(
let params_name = params.name();
let bench_id = format!("{bench_name}::{fn_name}::{params_name}::{type_name}");
println!("{bench_id}");
c.bench_function(&bench_id, |b| {
let mut rng = thread_rng();
@@ -468,7 +466,6 @@ fn bench_transfer_throughput<FheType, F>(
let bench_id = format!(
"{bench_name}::throughput::{fn_name}::{params_name}::{type_name}::{num_elems}_elems"
);
println!("{bench_id}");
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
let from_amounts = (0..num_elems)
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
@@ -532,7 +529,6 @@ fn cuda_bench_transfer_throughput<FheType, F>(
let bench_id = format!(
"{bench_name}::throughput::{fn_name}::{params_name}::{type_name}::{num_elems}_elems"
);
println!("{bench_id}");
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
let from_amounts = (0..num_elems)
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
@@ -614,7 +610,6 @@ fn hpu_bench_transfer_throughput<FheType, F>(
let bench_id = format!(
"{bench_name}::throughput::{fn_name}::{params_name}::{type_name}::{num_elems}_elems"
);
println!("{bench_id}");
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
let from_amounts = (0..num_elems)
.map(|_| FheType::encrypt(rng.gen::<u64>(), client_key))
@@ -688,7 +683,6 @@ fn hpu_bench_transfer_throughput_simd<FheType, F>(
group.throughput(Throughput::Elements(real_num_elems));
let bench_id =
format!("{bench_name}::throughput::{fn_name}::{params_name}::{type_name}::{real_num_elems}_elems");
println!("{bench_id}");
group.bench_with_input(&bench_id, &num_elems, |b, &num_elems| {
let from_amounts = (0..num_elems)
.map(|_| {

View File

@@ -91,7 +91,6 @@ fn bench_sns_only_fhe_type<FheType>(
match get_bench_type() {
BenchmarkType::Latency => {
bench_id = format!("{bench_id_prefix}::{bench_id_suffix}");
println!("{bench_id}");
#[cfg(feature = "gpu")]
configure_gpu(&client_key);
@@ -106,7 +105,6 @@ fn bench_sns_only_fhe_type<FheType>(
}
BenchmarkType::Throughput => {
bench_id = format!("{bench_id_prefix}::throughput::{bench_id_suffix}");
println!("{bench_id}");
let params = client_key.computation_parameters();
let num_blocks = num_bits
.div_ceil((params.message_modulus().0 * params.carry_modulus().0).ilog2() as usize);
@@ -235,7 +233,6 @@ fn bench_decomp_sns_comp_fhe_type<FheType>(
match get_bench_type() {
BenchmarkType::Latency => {
bench_id = format!("{bench_id_prefix}::{bench_id_suffix}");
println!("{bench_id}");
#[cfg(feature = "gpu")]
configure_gpu(&client_key);
@@ -258,7 +255,6 @@ fn bench_decomp_sns_comp_fhe_type<FheType>(
}
BenchmarkType::Throughput => {
bench_id = format!("{bench_id_prefix}::throughput::{bench_id_suffix}");
println!("{bench_id}");
let params = client_key.computation_parameters();
let num_blocks = num_bits
.div_ceil((params.message_modulus().0 * params.carry_modulus().0).ilog2() as usize);

View File

@@ -44,7 +44,6 @@ pub mod cuda {
const NUM_AES_INPUTS: usize = 1;
const SBOX_PARALLELISM: usize = 16;
let bench_id = format!("{param_name}::{NUM_AES_INPUTS}_input_encryption");
println!("{bench_id}");
let round_keys = sks.key_expansion(&d_key, &streams);
@@ -74,7 +73,6 @@ pub mod cuda {
{
let bench_id = format!("{param_name}::key_expansion");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
black_box(sks.key_expansion(&d_key, &streams));
@@ -122,7 +120,6 @@ pub mod cuda {
let round_keys = sks.key_expansion(&d_key, &streams);
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
black_box(sks.aes_encrypt(

View File

@@ -48,7 +48,6 @@ pub mod cuda {
const NUM_AES_INPUTS: usize = 1;
const SBOX_PARALLELISM: usize = 16;
let bench_id = format!("{param_name}::{NUM_AES_INPUTS}_input_encryption");
println!("{bench_id}");
let round_keys = sks.key_expansion_256(&d_key, &streams);
@@ -78,7 +77,6 @@ pub mod cuda {
{
let bench_id = format!("{param_name}::key_expansion");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
black_box(sks.key_expansion_256(&d_key, &streams));
@@ -126,7 +124,6 @@ pub mod cuda {
let round_keys = sks.key_expansion_256(&d_key, &streams);
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
black_box(sks.aes_256_encrypt(

View File

@@ -55,7 +55,6 @@ fn bench_server_key_binary_function_dirty_inputs<F>(
let keys = LazyCell::new(move || KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix));
let bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, sks) = (&keys.0, &keys.1);
@@ -139,7 +138,6 @@ fn bench_server_key_binary_function_clean_inputs<F>(
});
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (sks, ct_0, ct_1) = (&bench_data.0, &bench_data.1, &bench_data.2);
b.iter(|| {
@@ -161,7 +159,6 @@ fn bench_server_key_binary_function_clean_inputs<F>(
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group
.sample_size(10)
.measurement_time(std::time::Duration::from_secs(30));
@@ -232,7 +229,6 @@ fn bench_server_key_unary_function_dirty_inputs<F>(
let keys = LazyCell::new(move || KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix));
let bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, sks) = (&keys.0, &keys.1);
@@ -311,7 +307,6 @@ fn bench_server_key_unary_function_clean_inputs<F>(
});
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (sks, ct_0) = (&bench_data.0, &bench_data.1);
@@ -332,7 +327,6 @@ fn bench_server_key_unary_function_clean_inputs<F>(
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group
.sample_size(10)
.measurement_time(std::time::Duration::from_secs(30));
@@ -395,7 +389,6 @@ fn bench_server_key_binary_scalar_function_dirty_inputs<F, G>(
let keys = LazyCell::new(move || KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix));
let bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, sks) = (&keys.0, &keys.1);
@@ -483,7 +476,6 @@ fn bench_server_key_binary_scalar_function_clean_inputs<F, G>(
});
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits_scalar_{bit_size}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (sks, ct_0, clear_1) = (&bench_data.0, &bench_data.1, bench_data.2);
@@ -505,7 +497,6 @@ fn bench_server_key_binary_scalar_function_clean_inputs<F, G>(
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group
.sample_size(10)
.measurement_time(std::time::Duration::from_secs(30));
@@ -614,7 +605,6 @@ fn if_then_else_parallelized(c: &mut Criterion) {
});
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (sks, condition, true_ct, false_ct) =
(&bench_data.0, &bench_data.1, &bench_data.2, &bench_data.3);
@@ -639,7 +629,6 @@ fn if_then_else_parallelized(c: &mut Criterion) {
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group
.sample_size(10)
.measurement_time(std::time::Duration::from_secs(30));
@@ -724,7 +713,6 @@ fn flip_parallelized(c: &mut Criterion) {
});
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (sks, condition, true_ct, false_ct) =
(&bench_data.0, &bench_data.1, &bench_data.2, &bench_data.3);
@@ -749,7 +737,6 @@ fn flip_parallelized(c: &mut Criterion) {
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group
.sample_size(10)
.measurement_time(std::time::Duration::from_secs(30));
@@ -839,7 +826,6 @@ fn ciphertexts_sum_parallelized(c: &mut Criterion) {
});
bench_id = format!("{bench_name}_{len}_ctxts::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (sks, ctxts) = (&bench_data.0, &bench_data.1);
@@ -869,7 +855,6 @@ fn ciphertexts_sum_parallelized(c: &mut Criterion) {
bench_id = format!(
"{bench_name}_{len}_ctxts::throughput::{param_name}::{bit_size}_bits"
);
println!("{bench_id}");
bench_group
.sample_size(10)
.measurement_time(std::time::Duration::from_secs(30));
@@ -1546,7 +1531,6 @@ mod cuda {
BenchmarkType::Latency => {
let streams = CudaStreams::new_multi_gpu();
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, _cpu_sks) =
@@ -1581,7 +1565,6 @@ mod cuda {
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group
.sample_size(10)
.measurement_time(std::time::Duration::from_secs(30));
@@ -1666,7 +1649,6 @@ mod cuda {
BenchmarkType::Latency => {
let streams = CudaStreams::new_multi_gpu();
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, _cpu_sks) =
@@ -1710,7 +1692,6 @@ mod cuda {
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group
.sample_size(10)
.measurement_time(std::time::Duration::from_secs(30));
@@ -1815,7 +1796,6 @@ mod cuda {
.measurement_time(std::time::Duration::from_secs(30));
bench_id =
format!("{bench_name}::{param_name}::{bit_size}_bits_scalar_{bit_size}"); // FIXME it makes no sense to duplicate `bit_size`
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, _cpu_sks) =
KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
@@ -1861,7 +1841,6 @@ mod cuda {
bench_id = format!(
"{bench_name}::throughput::{param_name}::{bit_size}_bits_scalar_{bit_size}"
);
println!("{bench_id}");
let elements = throughput_num_threads(num_block, pbs_count);
bench_group.throughput(Throughput::Elements(elements));
bench_group.bench_function(&bench_id, |b| {
@@ -1943,7 +1922,6 @@ mod cuda {
let stream = CudaStreams::new_multi_gpu();
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, _cpu_sks) =
@@ -1994,7 +1972,6 @@ mod cuda {
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group
.sample_size(10)
.measurement_time(std::time::Duration::from_secs(30));
@@ -2913,7 +2890,6 @@ mod cuda {
target_num_blocks * param.message_modulus().0.ilog2() as usize;
let bench_id =
format!("{bench_name}::{param_name}::{bit_size}_to_{target_bit_size}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, _sks) = KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
let gpu_sks = CudaServerKey::new(&cks, &stream);
@@ -3018,7 +2994,6 @@ mod hpu {
match get_bench_type() {
BenchmarkType::Latency => {
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, _sks) = KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
let hpu_device_mutex = KEY_CACHE.get_hpu_device(param);
@@ -3071,7 +3046,6 @@ mod hpu {
}
BenchmarkType::Throughput => {
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group
.sample_size(10)
.measurement_time(std::time::Duration::from_secs(120));
@@ -3701,7 +3675,6 @@ fn bench_server_key_cast_function<F>(
for target_num_blocks in all_num_blocks.iter().copied() {
let target_bit_size = target_num_blocks * param.message_modulus().0.ilog2() as usize;
let bench_id = format!("{bench_name}::{param_name}::{bit_size}_to_{target_bit_size}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, sks) = KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);

View File

@@ -54,7 +54,6 @@ fn cpu_glwe_packing(c: &mut Criterion) {
builder.push(ct);
bench_id_pack = format!("{bench_name}::pack_u{bit_size}");
println!("{bench_id_pack}");
bench_group.bench_function(&bench_id_pack, |b| {
b.iter(|| {
let compressed = builder.build(&compression_key);
@@ -66,7 +65,6 @@ fn cpu_glwe_packing(c: &mut Criterion) {
let compressed = builder.build(&compression_key);
bench_id_unpack = format!("{bench_name}::unpack_u{bit_size}");
println!("{bench_id_unpack}");
bench_group.bench_function(&bench_id_unpack, |b| {
b.iter(|| {
let unpacked: RadixCiphertext =
@@ -107,7 +105,6 @@ fn cpu_glwe_packing(c: &mut Criterion) {
.collect::<Vec<_>>();
bench_id_pack = format!("{bench_name}::throughput::pack_u{bit_size}");
println!("{bench_id_pack}");
bench_group.bench_function(&bench_id_pack, |b| {
b.iter(|| {
builders.par_iter().for_each(|builder| {
@@ -122,7 +119,6 @@ fn cpu_glwe_packing(c: &mut Criterion) {
.collect::<Vec<_>>();
bench_id_unpack = format!("{bench_name}::throughput::unpack_u{bit_size}");
println!("{bench_id_unpack}");
bench_group.bench_function(&bench_id_unpack, |b| {
b.iter(|| {
compressed.par_iter().for_each(|comp| {
@@ -229,7 +225,6 @@ mod cuda {
builder.push(d_ct, &stream);
bench_id_pack = format!("{bench_name}::pack_u{bit_size}");
println!("{bench_id_pack}");
bench_group.bench_function(&bench_id_pack, |b| {
b.iter(|| {
let compressed = builder.build(&cuda_compression_key, &stream);
@@ -255,7 +250,6 @@ mod cuda {
let local_streams = cuda_local_streams(num_block, elements as usize);
bench_id_pack = format!("{bench_name}::throughput::pack_u{bit_size}");
println!("{bench_id_pack}");
let cuda_compression_key_vec = (0..get_number_of_gpus())
.into_par_iter()
.map(|i| {
@@ -359,7 +353,6 @@ mod cuda {
let compressed = builder.build(&cuda_compression_key, &stream);
bench_id_unpack = format!("{bench_name}::unpack_u{bit_size}");
println!("{bench_id_unpack}");
bench_group.bench_function(&bench_id_unpack, |b| {
b.iter(|| {
let unpacked: CudaUnsignedRadixCiphertext = compressed
@@ -388,7 +381,6 @@ mod cuda {
let local_streams = cuda_local_streams(num_block, elements as usize);
bench_id_unpack = format!("{bench_name}::throughput::unpack_u{bit_size}");
println!("{bench_id_unpack}");
let builders = (0..elements)
.into_par_iter()
.map(|i| {

View File

@@ -89,7 +89,6 @@ mod cuda {
builder.push(d_ns_ct, &stream);
bench_id_pack = format!("{bench_name}::pack_u{bit_size}");
println!("{bench_id_pack}");
bench_group.bench_function(&bench_id_pack, |b| {
b.iter(|| {
let compressed =
@@ -158,7 +157,6 @@ mod cuda {
.collect::<Vec<_>>();
bench_id_pack = format!("{bench_name}::throughput::pack_u{bit_size}");
println!("{bench_id_pack}");
bench_group.bench_function(&bench_id_pack, |b| {
b.iter(|| {
builders.par_iter().for_each(
@@ -235,7 +233,6 @@ mod cuda {
let compressed = builder.build(&cuda_noise_squashing_compression_key, &stream);
bench_id_unpack = format!("{bench_name}::unpack_u{bit_size}");
println!("{bench_id_unpack}");
bench_group.bench_function(&bench_id_unpack, |b| {
b.iter(|| {
let unpacked: CudaSquashedNoiseRadixCiphertext =
@@ -313,7 +310,6 @@ mod cuda {
.collect::<Vec<_>>();
bench_id_unpack = format!("{bench_name}::throughput::unpack_u{bit_size}");
println!("{bench_id_unpack}");
bench_group.bench_function(&bench_id_unpack, |b| {
b.iter(|| {
compressed.par_iter().enumerate().for_each(|(i, comp)| {

View File

@@ -31,7 +31,6 @@ pub fn unsigned_oprf(c: &mut Criterion) {
bench_id_oprf_bounded =
format!("{bench_name}_bounded::{param_name}::{bit_size}_bits");
println!("{bench_id_oprf}");
bench_group.bench_function(&bench_id_oprf, |b| {
let (_, sk) = KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
@@ -43,7 +42,6 @@ pub fn unsigned_oprf(c: &mut Criterion) {
})
});
println!("{bench_id_oprf_bounded}");
bench_group.bench_function(&bench_id_oprf_bounded, |b| {
let (_, sk) = KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
@@ -77,7 +75,6 @@ pub fn unsigned_oprf(c: &mut Criterion) {
let elements = throughput_num_threads(num_block, pbs_count);
bench_group.throughput(Throughput::Elements(elements));
println!("{bench_id_oprf}");
bench_group.bench_function(&bench_id_oprf, |b| {
b.iter(|| {
(0..elements).into_par_iter().for_each(|_| {
@@ -89,7 +86,6 @@ pub fn unsigned_oprf(c: &mut Criterion) {
})
});
println!("{bench_id_oprf_bounded}");
bench_group.bench_function(&bench_id_oprf_bounded, |b| {
b.iter(|| {
(0..elements).into_par_iter().for_each(|_| {
@@ -156,7 +152,6 @@ pub mod cuda {
bench_id_oprf_bounded =
format!("{bench_name}_bounded::{param_name}::{bit_size}_bits");
println!("{bench_id_oprf}");
bench_group.bench_function(&bench_id_oprf, |b| {
let (cks, _cpu_sks) =
KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
@@ -173,7 +168,6 @@ pub mod cuda {
})
});
println!("{bench_id_oprf_bounded}");
bench_group.bench_function(&bench_id_oprf_bounded, |b| {
let (cks, _cpu_sks) =
KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
@@ -212,7 +206,6 @@ pub mod cuda {
let elements = throughput_num_threads(num_block, pbs_count);
bench_group.throughput(Throughput::Elements(elements));
println!("{bench_id_oprf}");
bench_group.bench_function(&bench_id_oprf, |b| {
b.iter(|| {
(0..elements).into_par_iter().for_each(|i| {
@@ -228,7 +221,6 @@ pub mod cuda {
})
});
println!("{bench_id_oprf_bounded}");
bench_group.bench_function(&bench_id_oprf_bounded, |b| {
b.iter(|| {
(0..elements).into_par_iter().for_each(|i| {

View File

@@ -69,7 +69,6 @@ fn execute_cpu_re_randomize(c: &mut Criterion, bit_size: usize) {
let mut d_re_randomized = decompressed.clone();
bench_id = format!("{bench_name}::latency_u{bit_size}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter_batched(
|| {
@@ -117,7 +116,6 @@ fn execute_cpu_re_randomize(c: &mut Criterion, bit_size: usize) {
.collect();
bench_id = format!("{bench_name}::throughput_u{bit_size}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter_batched(
|| {
@@ -259,7 +257,6 @@ mod cuda {
let mut d_re_randomized = d_decompressed.duplicate(&streams);
bench_id = format!("{bench_name}::latency_u{bit_size}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter_batched(
|| {
@@ -334,7 +331,6 @@ mod cuda {
.collect();
bench_id = format!("{bench_name}::throughput_u{bit_size}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter_batched(
|| {

View File

@@ -55,7 +55,6 @@ fn bench_server_key_signed_binary_function_clean_inputs<F>(
});
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (sks, ct_0, ct_1) = (&bench_data.0, &bench_data.1, &bench_data.2);
@@ -154,7 +153,6 @@ fn bench_server_key_signed_shift_function_clean_inputs<F>(
});
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (sks, ct_0, ct_1) = (&bench_data.0, &bench_data.1, &bench_data.2);
@@ -176,7 +174,6 @@ fn bench_server_key_signed_shift_function_clean_inputs<F>(
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
let elements = throughput_num_threads(num_block, pbs_count);
bench_group.throughput(Throughput::Elements(elements));
bench_group.bench_function(&bench_id, |b| {
@@ -254,7 +251,6 @@ fn bench_server_key_unary_function_clean_inputs<F>(
});
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (sks, ct_0) = (&bench_data.0, &bench_data.1);
b.iter(|| {
@@ -273,7 +269,6 @@ fn bench_server_key_unary_function_clean_inputs<F>(
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
let elements = throughput_num_threads(num_block, pbs_count);
bench_group.throughput(Throughput::Elements(elements));
bench_group.bench_function(&bench_id, |b| {
@@ -338,7 +333,6 @@ fn signed_if_then_else_parallelized(c: &mut Criterion) {
});
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (sks, condition, true_ct, false_ct) =
(&bench_data.0, &bench_data.1, &bench_data.2, &bench_data.3);
@@ -359,7 +353,6 @@ fn signed_if_then_else_parallelized(c: &mut Criterion) {
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
let elements = throughput_num_threads(num_block, pbs_count);
bench_group.throughput(Throughput::Elements(elements));
bench_group.bench_function(&bench_id, |b| {
@@ -865,7 +858,6 @@ fn bench_server_key_binary_scalar_function_clean_inputs<F, G>(
match get_bench_type() {
BenchmarkType::Latency => {
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits_scalar_{bit_size}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, sks) = KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
@@ -902,7 +894,6 @@ fn bench_server_key_binary_scalar_function_clean_inputs<F, G>(
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
let elements = throughput_num_threads(num_block, pbs_count);
bench_group.throughput(Throughput::Elements(elements));
bench_group.bench_function(&bench_id, |b| {
@@ -1055,7 +1046,6 @@ fn signed_flip_parallelized(c: &mut Criterion) {
});
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (sks, condition, true_ct, false_ct) =
(&bench_data.0, &bench_data.1, &bench_data.2, &bench_data.3);
@@ -1080,7 +1070,6 @@ fn signed_flip_parallelized(c: &mut Criterion) {
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group
.sample_size(10)
.measurement_time(std::time::Duration::from_secs(30));
@@ -1459,7 +1448,6 @@ fn bench_server_key_signed_cast_function<F>(
for target_num_blocks in all_num_blocks.iter().copied() {
let target_bit_size = target_num_blocks * param.message_modulus().0.ilog2() as usize;
let bench_id = format!("{bench_name}::{param_name}::{bit_size}_to_{target_bit_size}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, sks) = KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
@@ -1555,7 +1543,6 @@ mod cuda {
let stream = CudaStreams::new_multi_gpu();
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, _cpu_sks) =
@@ -1607,7 +1594,6 @@ mod cuda {
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
let elements = throughput_num_threads(num_block, pbs_count);
bench_group.throughput(Throughput::Elements(elements));
bench_group.bench_function(&bench_id, |b| {
@@ -1728,7 +1714,6 @@ mod cuda {
let stream = CudaStreams::new_multi_gpu();
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, _cpu_sks) =
@@ -1767,7 +1752,6 @@ mod cuda {
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
let elements = throughput_num_threads(num_block, pbs_count);
bench_group.throughput(Throughput::Elements(elements));
bench_group.bench_function(&bench_id, |b| {
@@ -1874,7 +1858,6 @@ mod cuda {
bench_id =
format!("{bench_name}::{param_name}::{bit_size}_bits_scalar_{bit_size}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, _cpu_sks) =
KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
@@ -1921,7 +1904,6 @@ mod cuda {
bench_id = format!(
"{bench_name}::throughput::{param_name}::{bit_size}_bits_scalar_{bit_size}"
);
println!("{bench_id}");
let elements = throughput_num_threads(num_block, pbs_count);
bench_group.throughput(Throughput::Elements(elements));
bench_group.bench_function(&bench_id, |b| {
@@ -2038,7 +2020,6 @@ mod cuda {
let streams = CudaStreams::new_multi_gpu();
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, _cpu_sks) =
@@ -2090,7 +2071,6 @@ mod cuda {
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
let elements = throughput_num_threads(num_block, pbs_count);
bench_group.throughput(Throughput::Elements(elements));
bench_group.bench_function(&bench_id, |b| {
@@ -2205,7 +2185,6 @@ mod cuda {
let stream = CudaStreams::new_multi_gpu();
bench_id = format!("{bench_name}::{param_name}::{bit_size}_bits");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, _cpu_sks) =
@@ -2256,7 +2235,6 @@ mod cuda {
let pbs_count = max(get_pbs_count(), 1); // Operation might not perform any PBS, so we take 1 as default
bench_id = format!("{bench_name}::throughput::{param_name}::{bit_size}_bits");
println!("{bench_id}");
let elements = throughput_num_threads(num_block, pbs_count);
bench_group.throughput(Throughput::Elements(elements));
bench_group.bench_function(&bench_id, |b| {
@@ -3076,7 +3054,6 @@ mod cuda {
target_num_blocks * param.message_modulus().0.ilog2() as usize;
let bench_id =
format!("{bench_name}::{param_name}::{bit_size}_to_{target_bit_size}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let (cks, _sks) = KEY_CACHE.get_from_params(param, IntegerKeyKind::Radix);
let gpu_sks = CudaServerKey::new(&cks, &stream);

View File

@@ -128,7 +128,6 @@ fn cpu_pke_zk_proof(c: &mut Criterion) {
bench_id = format!(
"{bench_name}::{param_name}_{bits}_bits_packed_{crs_size}_bits_crs_{zk_load}_ZK{zk_vers:?}"
);
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let input_msg = rng.gen::<u64>();
let messages = vec![input_msg; fhe_uint_count];
@@ -150,7 +149,6 @@ fn cpu_pke_zk_proof(c: &mut Criterion) {
bench_id = format!(
"{bench_name}::throughput::{param_name}_{bits}_bits_packed_{crs_size}_bits_crs_{zk_load}_ZK{zk_vers:?}"
);
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let messages = (0..elements)
.map(|_| {
@@ -342,14 +340,12 @@ fn cpu_pke_zk_verify(c: &mut Criterion, results_file: &Path) {
vec![],
);
println!("{bench_id_verify}");
bench_group.bench_function(&bench_id_verify, |b| {
b.iter(|| {
let _ret = ct1.verify(&crs, &pk, &metadata);
});
});
println!("{bench_id_verify_and_expand}");
bench_group.bench_function(&bench_id_verify_and_expand, |b| {
b.iter(|| {
let _ret = ct1
@@ -390,7 +386,6 @@ fn cpu_pke_zk_verify(c: &mut Criterion, results_file: &Path) {
})
.collect::<Vec<_>>();
println!("{bench_id_verify}");
bench_group.bench_function(&bench_id_verify, |b| {
b.iter(|| {
cts.par_iter().for_each(|ct1| {
@@ -399,7 +394,6 @@ fn cpu_pke_zk_verify(c: &mut Criterion, results_file: &Path) {
});
});
println!("{bench_id_verify_and_expand}");
bench_group.bench_function(&bench_id_verify_and_expand, |b| {
b.iter(|| {
cts.par_iter().for_each(|ct1| {
@@ -628,14 +622,12 @@ mod cuda {
vec![],
);
println!("{bench_id_verify}");
bench_group.bench_function(&bench_id_verify, |b| {
b.iter(|| {
let _ret = ct1.verify(&crs, &pk, &metadata);
});
});
println!("{bench_id_expand_without_verify}");
bench_group.bench_function(&bench_id_expand_without_verify, |b| {
b.iter(|| {
let _ret = gpu_ct1
@@ -644,7 +636,6 @@ mod cuda {
});
});
println!("{bench_id_verify_and_expand}");
bench_group.bench_function(&bench_id_verify_and_expand, |b| {
b.iter(|| {
let _ret = gpu_ct1
@@ -697,7 +688,6 @@ mod cuda {
})
.collect::<Vec<_>>();
println!("{bench_id_verify}");
bench_group.bench_function(&bench_id_verify, |b| {
b.iter(|| {
cts.par_iter().for_each(|ct1| {
@@ -706,7 +696,6 @@ mod cuda {
});
});
println!("{bench_id_expand_without_verify}");
bench_group.bench_function(&bench_id_expand_without_verify, |b| {
let setup_encrypted_values = || {
let gpu_cts = cts.iter().enumerate().map(|(i, ct)| {
@@ -736,7 +725,6 @@ mod cuda {
}, BatchSize::SmallInput);
});
println!("{bench_id_verify_and_expand}");
bench_group.bench_function(&bench_id_verify_and_expand, |b| {
let setup_encrypted_values = || {
let gpu_cts = cts.iter().enumerate().map(|(i, ct)| {

View File

@@ -34,7 +34,6 @@ fn bench_server_key_unary_function<F>(
let mut ct = cks.encrypt(clear_text);
let bench_id = format!("{bench_name}::{}", param.name());
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
unary_op(sks, &mut ct);
@@ -80,7 +79,6 @@ fn bench_server_key_binary_function<F>(
let mut ct_1 = cks.encrypt(clear_1);
let bench_id = format!("{bench_name}::{}", param.name());
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
binary_op(sks, &mut ct_0, &mut ct_1);
@@ -125,7 +123,6 @@ fn bench_server_key_binary_scalar_function<F>(
let mut ct_0 = cks.encrypt(clear_0);
let bench_id = format!("{bench_name}::{}", param.name());
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
binary_op(sks, &mut ct_0, clear_1 as u8);
@@ -174,7 +171,6 @@ fn bench_server_key_binary_scalar_division_function<F>(
let mut ct_0 = cks.encrypt(clear_0);
let bench_id = format!("{bench_name}::{}", param.name());
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
binary_op(sks, &mut ct_0, clear_1 as u8);
@@ -211,7 +207,6 @@ fn carry_extract_bench(c: &mut Criterion) {
let ct_0 = cks.encrypt(clear_0);
let bench_id = format!("shortint::carry_extract::{}", param.name());
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let _ = sks.carry_extract(&ct_0);
@@ -250,7 +245,6 @@ fn programmable_bootstrapping_bench(c: &mut Criterion) {
let ctxt = cks.encrypt(clear_0);
let bench_id = format!("shortint::programmable_bootstrap::{}", param.name());
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
@@ -294,7 +288,6 @@ fn server_key_from_compressed_key(c: &mut Criterion) {
let sks_compressed = CompressedServerKey::new(keys.client_key());
let bench_id = format!("shortint::uncompress_key::{}", param.name());
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
let clone_compressed_key = || sks_compressed.clone();

View File

@@ -26,7 +26,6 @@ pub fn pack_cast_64(c: &mut Criterion) {
let vec_ct = vec![client_key_1.encrypt(1); 64];
let bench_id = format!("{bench_name}_{ks_param_name}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let _ = (0..32)
@@ -79,7 +78,6 @@ pub fn pack_cast(c: &mut Criterion) {
let ct_2 = client_key_1.encrypt(1);
let bench_id = format!("{bench_name}_{ks_param_name}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let _ = ksk.cast(
@@ -120,7 +118,6 @@ pub fn cast(c: &mut Criterion) {
let ct = client_key_1.encrypt(1);
let bench_id = format!("{bench_name}_{ks_param_name}");
println!("{bench_id}");
bench_group.bench_function(&bench_id, |b| {
b.iter(|| {
let _ = ksk.cast(&ct);

View File

@@ -24,8 +24,6 @@ fn glwe_packing(c: &mut Criterion) {
let ct: Vec<_> = (0..number_to_pack).map(|_| cks.encrypt(0)).collect();
let bench_id = format!("{bench_name}::pack");
println!("{bench_id}");
bench_group.bench_function("pack".to_owned(), |b| {
b.iter(|| {
let packed = compression_key.compress_ciphertexts_into_list(&ct);
@@ -34,10 +32,8 @@ fn glwe_packing(c: &mut Criterion) {
})
});
let bench_id = format!("{bench_name}::unpack_all");
println!("{bench_id}");
let packed = compression_key.compress_ciphertexts_into_list(&ct);
bench_group.bench_function(bench_id, |b| {
bench_group.bench_function("unpack_all".to_owned(), |b| {
b.iter(|| {
(0..number_to_pack).into_par_iter().for_each(|i| {
let unpacked = decompression_key.unpack(&packed, i);
@@ -47,9 +43,7 @@ fn glwe_packing(c: &mut Criterion) {
})
});
let bench_id = format!("{bench_name}::unpack_one_lwe");
println!("{bench_id}");
bench_group.bench_function(bench_id, |b| {
bench_group.bench_function("unpack_one_lwe".to_owned(), |b| {
b.iter(|| {
let unpacked = decompression_key.unpack(&packed, 0);
@@ -57,9 +51,7 @@ fn glwe_packing(c: &mut Criterion) {
})
});
let bench_id = format!("{bench_name}::unpack_64b");
println!("{bench_id}");
bench_group.bench_function(bench_id, |b| {
bench_group.bench_function("unpack_64b".to_owned(), |b| {
b.iter(|| {
(0..32).into_par_iter().for_each(|i| {
let unpacked = decompression_key.unpack(&packed, i);
@@ -69,9 +61,7 @@ fn glwe_packing(c: &mut Criterion) {
})
});
let bench_id = format!("{bench_name}::pack_unpack");
println!("{bench_id}");
bench_group.bench_function(bench_id, |b| {
bench_group.bench_function("pack_unpack".to_owned(), |b| {
b.iter(|| {
let packed = compression_key.compress_ciphertexts_into_list(&ct);

View File

@@ -14,9 +14,7 @@ fn oprf(c: &mut Criterion) {
let keys = KEY_CACHE.get_from_param(param);
let sks = keys.server_key();
let bench_id = format!("2-bits-oprf::{}", param.name());
println!("{bench_id}");
bench_group.bench_function(bench_id, |b| {
bench_group.bench_function(format!("2-bits-oprf::{}", param.name()), |b| {
b.iter(|| {
_ = black_box(sks.generate_oblivious_pseudo_random(Seed(0), 2));
})