MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / main

Function main

ciphercore-base/src/bin/ciphercore_a2b.rs:59–85  ·  view source on GitHub ↗

This binary prints the serialized a2b/b2a context on the non-encrypted input in (serde) JSON format. It is needed for measuring performance of a2b/b2a conversions. # Arguments `k` - number of elements of an array (i.e. 2 n ) `st` - scalar type of array elements `inverse` - generate b2a graph instead of a2b # Usage `< this_binary > -s `

()

Source from the content-addressed store, hash-verified

57///
58/// `< this_binary > -s <st> <k>`
59fn main() {
60 // Initialize a logger that collects information about errors and panics within CipherCore.
61 // This information can be accessed via RUST_LOG.
62 env_logger::init();
63 // Execute CipherCore code such that all the internal errors are properly formatted and logged.
64 execute_main(|| -> Result<()> {
65 let args = Args::parse();
66 let st = ScalarType::from_str(&args.scalar_type)?;
67 // Create a context
68 let context = create_context()?;
69
70 let graph = if args.inverse {
71 gen_a2b_graph(context.clone(), args.k, st)
72 } else {
73 gen_b2a_graph(context.clone(), args.k, st)
74 }?;
75
76 // Set this graph as main to be able to finalize the context
77 context.set_main_graph(graph)?;
78 // Finalize the context. This makes sure that all the graphs of the contexts are ready for computation.
79 // After this action the context can't be changed.
80 context.finalize()?;
81 // Serialize the context and print it to stdout
82 println!("{}", serde_json::to_string(&context)?);
83 Ok(())
84 });
85}

Callers

nothing calls this directly

Calls 7

execute_mainFunction · 0.85
gen_a2b_graphFunction · 0.85
gen_b2a_graphFunction · 0.85
cloneMethod · 0.80
create_contextFunction · 0.50
set_main_graphMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected