Files
circ/examples/opa_bench.rs
Alex Ozdemir be8741c615 Configuration system. Kill DFL_T (#127)
* Configuration system. Kill DFL_T

* add circ::cfg::CircCfg that holds cfg info
   * it's constructible from circ_opt::CircOpt
      * implements clap::Args, so you can set it from your compiler's
        CLI/envvars
      * defined in external crate to keep clap out of our main build
      * organized by circ module, but not feature gated
         *  no point: the build wouldn't meaningfully change
      * includes a way to set the default field
* added circ::cfg::set and circ::cfg::cfg
   * also circ::cfg::set_default and circ::cfg::set_cfg
   * access a sync::once_cell, static configuration
* killed DFL_T

* workflows
   * unit-tested component probably need to not read circ::cfg::cfg.
   * compilers need to call circ::cfg::set or circ::cfg::set_default.

* rm dead features
2022-12-25 20:53:27 -08:00

36 lines
984 B
Rust

use circ::cfg::clap::{self, Parser};
use circ::ir::term::*;
use circ::target::aby::assignment::ilp;
use circ::term;
#[derive(Debug, Parser)]
#[command(
name = "opa_bench",
about = "Optimal Protocol Assignment via ILP benchmarker"
)]
struct Options {
/// Number of parties for an MPC. If missing, generates a proof circuit.
#[arg(name = "MULTS")]
n_mults: u32,
}
fn main() {
env_logger::Builder::from_default_env()
.format_level(false)
.format_timestamp(None)
.init();
let options = Options::parse();
let v = leaf_term(Op::Var("a".to_owned(), Sort::BitVector(32)));
let mut t = v.clone();
for _i in 0..options.n_mults {
t = term![BV_MUL; t.clone(), t.clone()];
}
let cs = Computation {
outputs: vec![term![Op::Eq; t, v]],
metadata: ComputationMetadata::default(),
precomputes: Default::default(),
};
let _assignment = ilp::assign(&cs, "hycc");
//dbg!(&assignment);
}