Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hercules
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
Hercules
Commits
cf91c103
Commit
cf91c103
authored
1 month ago
by
Russel Arbore
Browse files
Options
Downloads
Patches
Plain Diff
Create two benches in backprop, one old size, one new size
parent
b442e4f8
No related branches found
No related tags found
1 merge request
!215
Large benches
Pipeline
#202043
passed
1 month ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
juno_samples/rodinia/backprop/benches/backprop_bench.rs
+46
-41
46 additions, 41 deletions
juno_samples/rodinia/backprop/benches/backprop_bench.rs
with
46 additions
and
41 deletions
juno_samples/rodinia/backprop/benches/backprop_bench.rs
+
46
−
41
View file @
cf91c103
...
@@ -9,7 +9,8 @@ juno_build::juno!("backprop");
...
@@ -9,7 +9,8 @@ juno_build::juno!("backprop");
// We need this even though we don't use anything from the library because of
// We need this even though we don't use anything from the library because of
// Rust build scripts only linking static libraries into the library, and not
// Rust build scripts only linking static libraries into the library, and not
// into the benchmark binary. Ugh!
// into the benchmark binary. Yuck!
#[allow(unused_imports)]
use
juno_backprop
::
*
;
use
juno_backprop
::
*
;
fn
backprop_bench
(
c
:
&
mut
Criterion
)
{
fn
backprop_bench
(
c
:
&
mut
Criterion
)
{
...
@@ -18,52 +19,56 @@ fn backprop_bench(c: &mut Criterion) {
...
@@ -18,52 +19,56 @@ fn backprop_bench(c: &mut Criterion) {
let
mut
rng
=
StdRng
::
seed_from_u64
(
7
);
let
mut
rng
=
StdRng
::
seed_from_u64
(
7
);
let
input_n
=
33554432
;
let
mut
bench
=
|
name
,
input_n
:
usize
|
{
let
hidden_n
=
16
;
let
hidden_n
=
16
;
let
output_n
=
1
;
let
output_n
=
1
;
let
mut
input_vals
=
vec!
[
0.0f32
;
input_n
+
1
];
let
mut
input_vals
=
vec!
[
0.0f32
;
input_n
+
1
];
input_vals
[
0
]
=
1.0
;
input_vals
[
0
]
=
1.0
;
// For some reason the bpnn_randomize_row function used on target just sets it to 0.1
// For some reason the bpnn_randomize_row function used on target just sets it to 0.1
let
target
=
vec!
[
0.1f32
;
output_n
+
1
];
let
target
=
vec!
[
0.1f32
;
output_n
+
1
];
let
input_weights
=
(
0
..
(
input_n
+
1
)
*
(
hidden_n
+
1
))
let
input_weights
=
(
0
..
(
input_n
+
1
)
*
(
hidden_n
+
1
))
.map
(|
_
|
rng
.random
::
<
f32
>
())
.map
(|
_
|
rng
.random
::
<
f32
>
())
.collect
::
<
Vec
<
_
>>
();
.collect
::
<
Vec
<
_
>>
();
let
hidden_weights
=
(
0
..
(
hidden_n
+
1
)
*
(
output_n
+
1
))
let
hidden_weights
=
(
0
..
(
hidden_n
+
1
)
*
(
output_n
+
1
))
.map
(|
_
|
rng
.random
::
<
f32
>
())
.map
(|
_
|
rng
.random
::
<
f32
>
())
.collect
::
<
Vec
<
_
>>
();
.collect
::
<
Vec
<
_
>>
();
let
input_prev_weights
=
vec!
[
0.0
;
(
input_n
+
1
)
*
(
hidden_n
+
1
)];
let
input_prev_weights
=
vec!
[
0.0
;
(
input_n
+
1
)
*
(
hidden_n
+
1
)];
let
hidden_prev_weights
=
vec!
[
0.0
;
(
hidden_n
+
1
)
*
(
output_n
+
1
)];
let
hidden_prev_weights
=
vec!
[
0.0
;
(
hidden_n
+
1
)
*
(
output_n
+
1
)];
let
mut
r
=
runner!
(
backprop
);
let
mut
r
=
runner!
(
backprop
);
let
input_vals
=
HerculesImmBox
::
from
(
&
input_vals
as
&
[
f32
]);
let
input_vals
=
HerculesImmBox
::
from
(
&
input_vals
as
&
[
f32
]);
let
target
=
HerculesImmBox
::
from
(
&
target
as
&
[
f32
]);
let
target
=
HerculesImmBox
::
from
(
&
target
as
&
[
f32
]);
let
mut
input_weights
=
HerculesMutBox
::
from
(
input_weights
.to_vec
());
let
mut
input_weights
=
HerculesMutBox
::
from
(
input_weights
.to_vec
());
let
mut
hidden_weights
=
HerculesMutBox
::
from
(
hidden_weights
.to_vec
());
let
mut
hidden_weights
=
HerculesMutBox
::
from
(
hidden_weights
.to_vec
());
let
mut
input_prev_weights
=
HerculesMutBox
::
from
(
input_prev_weights
.to_vec
());
let
mut
input_prev_weights
=
HerculesMutBox
::
from
(
input_prev_weights
.to_vec
());
let
mut
hidden_prev_weights
=
HerculesMutBox
::
from
(
hidden_prev_weights
.to_vec
());
let
mut
hidden_prev_weights
=
HerculesMutBox
::
from
(
hidden_prev_weights
.to_vec
());
group
.bench_function
(
"backprop bench large"
,
|
b
|
{
group
.bench_function
(
name
,
|
b
|
{
b
.iter
(||
{
b
.iter
(||
{
async_std
::
task
::
block_on
(
async
{
async_std
::
task
::
block_on
(
async
{
r
.run
(
r
.run
(
input_n
as
u64
,
input_n
as
u64
,
hidden_n
as
u64
,
hidden_n
as
u64
,
output_n
as
u64
,
output_n
as
u64
,
input_vals
.to
(),
input_vals
.to
(),
input_weights
.to
(),
input_weights
.to
(),
hidden_weights
.to
(),
hidden_weights
.to
(),
target
.to
(),
target
.to
(),
input_prev_weights
.to
(),
input_prev_weights
.to
(),
hidden_prev_weights
.to
(),
hidden_prev_weights
.to
(),
)
)
.await
.await
});
});
})
})
});
});
};
bench
(
"backprop bench small"
,
65536
);
bench
(
"backprop bench large"
,
33554432
);
}
}
criterion_group!
(
benches
,
backprop_bench
);
criterion_group!
(
benches
,
backprop_bench
);
...
...
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