mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 03:55:04 -05:00
chore(cpp): remove c interface
This commit is contained in:
@@ -16,11 +16,7 @@ statrs = "0.15.0"
|
||||
approx = "0.5"
|
||||
pretty_assertions = "1.2.1"
|
||||
|
||||
[build-dependencies]
|
||||
cbindgen = "0.23.0"
|
||||
|
||||
[lib]
|
||||
crate-type= [
|
||||
"staticlib", # concretecompiler
|
||||
"lib", # rust
|
||||
"lib", # rust
|
||||
]
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
use cbindgen::Config;
|
||||
use std::env;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
fn main() {
|
||||
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||
let package_name = env::var("CARGO_PKG_NAME").unwrap();
|
||||
let target_dir = match env::var("CARGO_TARGET_DIR") {
|
||||
Ok(target) => PathBuf::from(target),
|
||||
_ => PathBuf::from(crate_dir.clone()).join("../target"),
|
||||
};
|
||||
|
||||
let header_name = format!("{}.h", package_name);
|
||||
let header_path = target_dir
|
||||
.join("include")
|
||||
.join(header_name)
|
||||
.display()
|
||||
.to_string();
|
||||
|
||||
let config = Config::from_file(Path::new(&crate_dir).join("cbindgen.toml")).unwrap();
|
||||
|
||||
let result = cbindgen::generate_with_config(&crate_dir, config);
|
||||
let exit_code = match result {
|
||||
Err(err) => {
|
||||
eprintln!("{}", err);
|
||||
1
|
||||
}
|
||||
Ok(content) => {
|
||||
let _changed = content.write_to_file(&header_path);
|
||||
0
|
||||
}
|
||||
};
|
||||
std::process::exit(exit_code)
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
# See https://github.com/eqrion/cbindgen/blob/master/docs.md#cbindgentoml
|
||||
# for detailed documentation of every option here.
|
||||
|
||||
language = "C++"
|
||||
namespaces = ["concrete_optimizer"]
|
||||
|
||||
[parse]
|
||||
include = ["optimisation"]
|
||||
|
||||
[export]
|
||||
item_types = ["structs", "functions"]
|
||||
@@ -25,47 +25,3 @@ pub mod parameters;
|
||||
pub mod pareto;
|
||||
pub mod security;
|
||||
pub mod weight;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn optimise_bootstrap(
|
||||
precision: u64,
|
||||
security_level: u64,
|
||||
noise_factor: f64,
|
||||
maximum_acceptable_error_probability: f64,
|
||||
) -> optimisation::atomic_pattern::Solution {
|
||||
use global_parameters::DEFAUT_DOMAINS;
|
||||
let sum_size = 1;
|
||||
let glwe_log_polynomial_sizes = DEFAUT_DOMAINS
|
||||
.glwe_pbs_constrained
|
||||
.log2_polynomial_size
|
||||
.as_vec();
|
||||
let glwe_dimensions = DEFAUT_DOMAINS.glwe_pbs_constrained.glwe_dimension.as_vec();
|
||||
let internal_lwe_dimensions = DEFAUT_DOMAINS.free_glwe.glwe_dimension.as_vec();
|
||||
let result = optimisation::atomic_pattern::optimise_one::<u64>(
|
||||
sum_size,
|
||||
precision,
|
||||
security_level,
|
||||
noise_factor,
|
||||
maximum_acceptable_error_probability,
|
||||
&glwe_log_polynomial_sizes,
|
||||
&glwe_dimensions,
|
||||
&internal_lwe_dimensions,
|
||||
None,
|
||||
);
|
||||
match result.best_solution {
|
||||
Some(solution) => solution,
|
||||
None => optimisation::atomic_pattern::Solution {
|
||||
input_lwe_dimension: 0,
|
||||
internal_ks_output_lwe_dimension: 0,
|
||||
ks_decomposition_level_count: 0,
|
||||
ks_decomposition_base_log: 0,
|
||||
glwe_polynomial_size: 0,
|
||||
glwe_dimension: 0,
|
||||
br_decomposition_level_count: 0,
|
||||
br_decomposition_base_log: 0,
|
||||
complexity: 0.0,
|
||||
noise_max: 0.0,
|
||||
p_error: 1.0, // error probability
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ const PARETO_CUTS: bool = true; // 75ms
|
||||
const CROSS_PARETO_CUTS: bool = PARETO_CUTS && true; // 70ms
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct Solution {
|
||||
pub input_lwe_dimension: u64, //n_big
|
||||
pub internal_ks_output_lwe_dimension: u64, //n_small
|
||||
|
||||
Reference in New Issue
Block a user