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
Compare revisions
7b91d3ad027a97d05f2bb0206e5e59a1c42e8e13 to 0dd67a120ced15edb6cb77722dd6e45b2a7ae090
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
dragoon/komodo
Select target project
No results found
0dd67a120ced15edb6cb77722dd6e45b2a7ae090
Select Git revision
Swap
Target
dragoon/komodo
Select target project
dragoon/komodo
a.stevan/komodo
c.heme/komodo
3 results
7b91d3ad027a97d05f2bb0206e5e59a1c42e8e13
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (3)
move linalg bench to `examples/benches/`
· 04702d8d
STEVAN Antoine
authored
1 year ago
04702d8d
remove useless "harness" on examples
· be008b69
STEVAN Antoine
authored
1 year ago
be008b69
migrate "linalg" bench to PLNK
· 0dd67a12
STEVAN Antoine
authored
1 year ago
0dd67a12
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Cargo.toml
+4
-7
4 additions, 7 deletions
Cargo.toml
benches/linalg.rs
+0
-69
0 additions, 69 deletions
benches/linalg.rs
examples/benches/linalg.rs
+67
-0
67 additions, 0 deletions
examples/benches/linalg.rs
with
71 additions
and
76 deletions
Cargo.toml
View file @
0dd67a12
...
...
@@ -55,10 +55,6 @@ criterion = "0.3"
name
=
"recoding"
harness
=
false
[[bench]]
name
=
"linalg"
harness
=
false
[[example]]
name
=
"bench_commit"
path
=
"examples/benches/commit.rs"
...
...
@@ -70,14 +66,15 @@ path = "examples/benches/setup_size.rs"
[[example]]
name
=
"bench_field_operations"
path
=
"examples/benches/operations/field.rs"
harness
=
false
[[example]]
name
=
"bench_curve_group_operations"
path
=
"examples/benches/operations/curve_group.rs"
harness
=
false
[[example]]
name
=
"bench_setup"
path
=
"examples/benches/setup.rs"
harness
=
false
[[example]]
name
=
"bench_linalg"
path
=
"examples/benches/linalg.rs"
This diff is collapsed.
Click to expand it.
benches/linalg.rs
deleted
100644 → 0
View file @
7b91d3ad
// see `benches/README.md`
use
std
::
time
::
Duration
;
use
ark_ff
::
PrimeField
;
use
criterion
::{
black_box
,
criterion_group
,
criterion_main
,
Criterion
};
use
komodo
::
linalg
::
Matrix
;
fn
inverse_template
<
F
:
PrimeField
>
(
c
:
&
mut
Criterion
,
n
:
usize
,
curve
:
&
str
)
{
let
mut
rng
=
rand
::
thread_rng
();
let
matrix
=
Matrix
::
<
F
>
::
random
(
n
,
n
,
&
mut
rng
);
c
.bench_function
(
&
format!
(
"inverse {}x{} on {}"
,
n
,
n
,
curve
),
|
b
|
{
b
.iter
(||
matrix
.invert
()
.unwrap
())
});
}
fn
inverse
(
c
:
&
mut
Criterion
)
{
for
n
in
[
10
,
15
,
20
,
30
,
40
,
60
,
80
,
120
,
160
,
240
,
320
]
{
inverse_template
::
<
ark_bls12_381
::
Fr
>
(
c
,
black_box
(
n
),
"BLS12-381"
);
inverse_template
::
<
ark_bn254
::
Fr
>
(
c
,
black_box
(
n
),
"BN-254"
);
inverse_template
::
<
ark_pallas
::
Fr
>
(
c
,
black_box
(
n
),
"PALLAS"
);
}
}
fn
transpose_template
<
F
:
PrimeField
>
(
c
:
&
mut
Criterion
,
n
:
usize
,
curve
:
&
str
)
{
let
mut
rng
=
rand
::
thread_rng
();
let
matrix
=
Matrix
::
<
F
>
::
random
(
n
,
n
,
&
mut
rng
);
c
.bench_function
(
&
format!
(
"transpose {}x{} on {}"
,
n
,
n
,
curve
),
|
b
|
{
b
.iter
(||
matrix
.transpose
())
});
}
fn
transpose
(
c
:
&
mut
Criterion
)
{
for
n
in
[
10
,
15
,
20
,
30
,
40
,
60
,
80
,
120
,
160
,
240
,
320
]
{
transpose_template
::
<
ark_bls12_381
::
Fr
>
(
c
,
black_box
(
n
),
"BLS-12-381"
);
transpose_template
::
<
ark_bn254
::
Fr
>
(
c
,
black_box
(
n
),
"BN-254"
);
transpose_template
::
<
ark_pallas
::
Fr
>
(
c
,
black_box
(
n
),
"PALLAS"
);
}
}
fn
mul_template
<
F
:
PrimeField
>
(
c
:
&
mut
Criterion
,
n
:
usize
,
curve
:
&
str
)
{
let
mut
rng
=
rand
::
thread_rng
();
let
mat_a
=
Matrix
::
<
F
>
::
random
(
n
,
n
,
&
mut
rng
);
let
mat_b
=
Matrix
::
<
F
>
::
random
(
n
,
n
,
&
mut
rng
);
c
.bench_function
(
&
format!
(
"mul {}x{} on {}"
,
n
,
n
,
curve
),
|
b
|
{
b
.iter
(||
mat_a
.mul
(
&
mat_b
))
});
}
fn
mul
(
c
:
&
mut
Criterion
)
{
for
n
in
[
10
,
15
,
20
,
30
,
40
,
60
,
80
,
120
]
{
mul_template
::
<
ark_bls12_381
::
Fr
>
(
c
,
black_box
(
n
),
"BLS-12-381"
);
mul_template
::
<
ark_bn254
::
Fr
>
(
c
,
black_box
(
n
),
"BN-254"
);
mul_template
::
<
ark_pallas
::
Fr
>
(
c
,
black_box
(
n
),
"PALLAS"
);
}
}
criterion_group!
(
name
=
benches
;
config
=
Criterion
::
default
()
.warm_up_time
(
Duration
::
from_secs_f32
(
0.5
))
.sample_size
(
10
);
targets
=
inverse
,
transpose
,
mul
);
criterion_main!
(
benches
);
This diff is collapsed.
Click to expand it.
examples/benches/linalg.rs
0 → 100644
View file @
0dd67a12
// see `benches/README.md`
use
ark_ff
::
PrimeField
;
use
clap
::{
arg
,
command
,
Parser
};
use
komodo
::
linalg
::
Matrix
;
use
plnk
::
Bencher
;
fn
inverse_template
<
F
:
PrimeField
>
(
b
:
&
Bencher
,
n
:
usize
)
{
let
mut
rng
=
rand
::
thread_rng
();
let
matrix
=
Matrix
::
<
F
>
::
random
(
n
,
n
,
&
mut
rng
);
plnk
::
bench
(
b
,
&
format!
(
"inverse {}"
,
n
),
||
{
plnk
::
timeit
(||
matrix
.invert
()
.unwrap
())
});
}
fn
transpose_template
<
F
:
PrimeField
>
(
b
:
&
Bencher
,
n
:
usize
)
{
let
mut
rng
=
rand
::
thread_rng
();
let
matrix
=
Matrix
::
<
F
>
::
random
(
n
,
n
,
&
mut
rng
);
plnk
::
bench
(
b
,
&
format!
(
"transpose {}"
,
n
),
||
{
plnk
::
timeit
(||
matrix
.transpose
())
});
}
fn
mul_template
<
F
:
PrimeField
>
(
b
:
&
Bencher
,
n
:
usize
)
{
let
mut
rng
=
rand
::
thread_rng
();
let
mat_a
=
Matrix
::
<
F
>
::
random
(
n
,
n
,
&
mut
rng
);
let
mat_b
=
Matrix
::
<
F
>
::
random
(
n
,
n
,
&
mut
rng
);
plnk
::
bench
(
b
,
&
format!
(
"mul {}"
,
n
),
||
{
plnk
::
timeit
(||
mat_a
.mul
(
&
mat_b
))
});
}
#[derive(Parser)]
#[command(version,
about,
long_about
=
None)]
struct
Cli
{
/// the sizes of the matrices to consider
#[arg(num_args
=
1
..
,
value_delimiter
=
' '
)]
sizes
:
Vec
<
usize
>
,
/// the number of measurements to repeat each case, larger values will reduce the variance of
/// the measurements
#[arg(short,
long)]
nb_measurements
:
usize
,
}
fn
main
()
{
let
cli
=
Cli
::
parse
();
let
b
=
plnk
::
Bencher
::
new
(
cli
.nb_measurements
);
for
n
in
cli
.sizes
{
inverse_template
::
<
ark_bls12_381
::
Fr
>
(
&
b
.with_name
(
"BLS12-381"
),
n
);
inverse_template
::
<
ark_bn254
::
Fr
>
(
&
b
.with_name
(
"BN-254"
),
n
);
inverse_template
::
<
ark_pallas
::
Fr
>
(
&
b
.with_name
(
"PALLAS"
),
n
);
transpose_template
::
<
ark_bls12_381
::
Fr
>
(
&
b
.with_name
(
"BLS12-381"
),
n
);
transpose_template
::
<
ark_bn254
::
Fr
>
(
&
b
.with_name
(
"BN-254"
),
n
);
transpose_template
::
<
ark_pallas
::
Fr
>
(
&
b
.with_name
(
"PALLAS"
),
n
);
mul_template
::
<
ark_bls12_381
::
Fr
>
(
&
b
.with_name
(
"BLS12-381"
),
n
);
mul_template
::
<
ark_bn254
::
Fr
>
(
&
b
.with_name
(
"BN-254"
),
n
);
mul_template
::
<
ark_pallas
::
Fr
>
(
&
b
.with_name
(
"PALLAS"
),
n
);
}
}
This diff is collapsed.
Click to expand it.