Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Komodo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dragoon
Komodo
Commits
d5556206
Verified
Commit
d5556206
authored
10 months ago
by
STEVAN Antoine
Browse files
Options
Downloads
Patches
Plain Diff
remove "end to end" test case
parent
92520b53
No related branches found
No related tags found
1 merge request
!142
remove "end to end" test case from "inbreeding"
Pipeline
#5389
passed
10 months ago
Stage: fmt
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bins/inbreeding/src/.nushell/run.nu
+0
-1
0 additions, 1 deletion
bins/inbreeding/src/.nushell/run.nu
bins/inbreeding/src/main.rs
+21
-99
21 additions, 99 deletions
bins/inbreeding/src/main.rs
with
21 additions
and
100 deletions
bins/inbreeding/src/.nushell/run.nu
+
0
−
1
View file @
d5556206
...
...
@@ -92,7 +92,6 @@ export def main [
--measurement-schedule $options.measurement_schedule
--measurement-schedule-start $options.measurement_schedule_start
-t $options.max_t
--test-case recoding
--strategy $s
--environment $options.environment
--prng-seed $seed
...
...
This diff is collapsed.
Click to expand it.
bins/inbreeding/src/main.rs
+
21
−
99
View file @
d5556206
...
...
@@ -2,7 +2,7 @@ use std::process::exit;
use
ark_ff
::
PrimeField
;
use
clap
::
{
Parser
,
ValueEnum
}
;
use
clap
::
Parser
;
use
indicatif
::{
MultiProgress
,
ProgressBar
,
ProgressStyle
};
use
komodo
::{
error
::
KomodoError
,
...
...
@@ -57,50 +57,6 @@ fn measure_inbreeding<F: PrimeField>(
count
as
f64
/
nb_measurements
as
f64
}
fn
end_to_end
<
F
,
Fun
>
(
bytes
:
&
[
u8
],
k
:
usize
,
n
:
usize
,
max_t
:
usize
,
nb_measurements
:
usize
,
measurement_schedule
:
Fun
,
rng
:
&
mut
(
impl
RngCore
+
Clone
),
)
->
Result
<
(),
KomodoError
>
where
F
:
PrimeField
,
Fun
:
Fn
(
usize
)
->
bool
,
{
let
original_shards
=
setup
(
bytes
,
k
,
n
)
?
;
let
mut
shards
=
original_shards
.clone
();
let
mp
=
MultiProgress
::
new
();
let
sty
=
ProgressStyle
::
with_template
(
"{msg}: {bar:40.cyan/blue} {pos:>7}/{len:7}"
)
.unwrap
()
.progress_chars
(
"##-"
);
let
pb
=
mp
.add
(
ProgressBar
::
new
(
max_t
as
u64
));
pb
.set_style
(
sty
.clone
());
pb
.set_message
(
"main"
);
for
t
in
0
..=
max_t
{
if
measurement_schedule
(
t
)
{
let
inbreeding
=
measure_inbreeding
(
&
shards
,
k
,
nb_measurements
,
&
mp
,
&
sty
,
rng
);
println!
(
"{}, {}"
,
t
,
inbreeding
);
}
// decode the data
let
data
=
fec
::
decode
(
original_shards
.clone
())
?
;
// re-encode a new random shard
let
encoding_mat
=
Matrix
::
vandermonde_unchecked
(
&
[
F
::
rand
(
rng
)],
k
);
let
new_shard
=
fec
::
encode
(
&
data
,
&
encoding_mat
)
?
.first
()
.unwrap
()
.clone
();
shards
.push
(
new_shard
);
pb
.inc
(
1
);
}
pb
.finish_with_message
(
"done"
);
Ok
(())
}
#[allow(clippy::too_many_arguments)]
fn
recoding
<
F
,
Fun
>
(
bytes
:
&
[
u8
],
...
...
@@ -164,12 +120,6 @@ fn parse_hex_string(s: &str) -> Result<[u8; 32], String> {
}
}
#[derive(ValueEnum,
Clone)]
enum
TestCase
{
EndToEnd
,
Recoding
,
}
#[derive(Parser)]
#[command(version,
about,
long_about
=
None)]
struct
Cli
{
...
...
@@ -186,14 +136,11 @@ struct Cli {
/// at each time step, shard $i$ will be used for recoding with probability $p$, otherwise, $j$
/// will be used with probability $1 - p$
#[arg(long)]
strategy
:
Option
<
String
>
,
strategy
:
String
,
/// something of the form `random-dynamic:<p>:<q>` where a proportion $q$ of the shards will be removed at
/// each step with probability $p$
#[arg(long)]
environment
:
Option
<
String
>
,
#[arg(long)]
test_case
:
TestCase
,
environment
:
String
,
/// the number of measurements to repeat each case, larger values will reduce the variance of
/// the measurements
...
...
@@ -233,47 +180,22 @@ fn main() {
&&
(
t
-
cli
.measurement_schedule_start
)
%
cli
.measurement_schedule
==
0
};
match
cli
.test_case
{
TestCase
::
EndToEnd
=>
{
eprintln!
(
"(k, 1)-re-encoding: k = {}, n = {}"
,
cli
.k
,
cli
.n
);
let
_
=
end_to_end
::
<
ark_pallas
::
Fr
,
_
>
(
&
bytes
,
cli
.k
,
cli
.n
,
cli
.t
,
cli
.nb_measurements
,
measurement_schedule
,
&
mut
rng
,
);
}
TestCase
::
Recoding
=>
{
if
cli
.strategy
.is_none
()
{
eprintln!
(
"recoding needs --strategy"
);
exit
(
1
);
}
if
cli
.environment
.is_none
()
{
eprintln!
(
"recoding needs --environment"
);
exit
(
1
);
}
let
environment
=
Environment
::
from_str
(
&
cli
.environment
.unwrap
())
.unwrap
();
let
strategy
=
Strategy
::
from_str
(
&
cli
.strategy
.unwrap
())
.unwrap
();
eprintln!
(
"k-recoding: k = {}, n = {}, strategy = {:?}, environment = {:?}"
,
cli
.k
,
cli
.n
,
strategy
,
environment
,
);
let
_
=
recoding
::
<
ark_pallas
::
Fr
,
_
>
(
&
bytes
,
cli
.k
,
cli
.n
,
cli
.t
,
strategy
,
environment
,
cli
.nb_measurements
,
measurement_schedule
,
&
mut
rng
,
);
}
}
let
environment
=
Environment
::
from_str
(
&
cli
.environment
)
.unwrap
();
let
strategy
=
Strategy
::
from_str
(
&
cli
.strategy
)
.unwrap
();
eprintln!
(
"k-recoding: k = {}, n = {}, strategy = {:?}, environment = {:?}"
,
cli
.k
,
cli
.n
,
strategy
,
environment
,
);
let
_
=
recoding
::
<
ark_pallas
::
Fr
,
_
>
(
&
bytes
,
cli
.k
,
cli
.n
,
cli
.t
,
strategy
,
environment
,
cli
.nb_measurements
,
measurement_schedule
,
&
mut
rng
,
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment