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
Merge requests
!200
Rodinia benches
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Rodinia benches
rodinia_benches
into
main
Overview
2
Commits
5
Pipelines
4
Changes
17
Merged
rarbore2
requested to merge
rodinia_benches
into
main
3 weeks ago
Overview
2
Commits
5
Pipelines
4
Changes
17
Expand
Set up benches for rodinia samples.
Edited
3 weeks ago
by
rarbore2
0
0
Merge request reports
Compare
main
version 3
5f96afc7
3 weeks ago
version 2
b4e9f258
3 weeks ago
version 1
cbd5e70e
3 weeks ago
main (base)
and
latest version
latest version
747b2f41
5 commits,
3 weeks ago
version 3
5f96afc7
4 commits,
3 weeks ago
version 2
b4e9f258
3 commits,
3 weeks ago
version 1
cbd5e70e
2 commits,
3 weeks ago
17 files
+
910
−
551
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
17
Search (e.g. *.vue) (Ctrl+P)
juno_samples/rodinia/backprop/benches/backprop_bench.rs
0 → 100644
+
70
−
0
Options
#![feature(concat_idents)]
use
criterion
::{
criterion_group
,
criterion_main
,
Criterion
};
use
rand
::
rngs
::
StdRng
;
use
rand
::{
Rng
,
SeedableRng
};
use
hercules_rt
::{
runner
,
HerculesImmBox
,
HerculesImmBoxTo
,
HerculesMutBox
,
HerculesMutBoxTo
};
juno_build
::
juno!
(
"backprop"
);
// 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
// into the benchmark binary. Ugh!
use
juno_backprop
::
*
;
fn
backprop_bench
(
c
:
&
mut
Criterion
)
{
let
mut
group
=
c
.benchmark_group
(
"backprop bench"
);
group
.sample_size
(
10
);
let
mut
rng
=
StdRng
::
seed_from_u64
(
7
);
let
input_n
=
65536
;
let
hidden_n
=
16
;
let
output_n
=
1
;
let
mut
input_vals
=
vec!
[
0.0f32
;
input_n
+
1
];
input_vals
[
0
]
=
1.0
;
// 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
input_weights
=
(
0
..
(
input_n
+
1
)
*
(
hidden_n
+
1
))
.map
(|
_
|
rng
.random
::
<
f32
>
())
.collect
::
<
Vec
<
_
>>
();
let
hidden_weights
=
(
0
..
(
hidden_n
+
1
)
*
(
output_n
+
1
))
.map
(|
_
|
rng
.random
::
<
f32
>
())
.collect
::
<
Vec
<
_
>>
();
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
mut
r
=
runner!
(
backprop
);
let
input_vals
=
HerculesImmBox
::
from
(
&
input_vals
as
&
[
f32
]);
let
target
=
HerculesImmBox
::
from
(
&
target
as
&
[
f32
]);
let
mut
input_weights
=
HerculesMutBox
::
from
(
input_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
hidden_prev_weights
=
HerculesMutBox
::
from
(
hidden_prev_weights
.to_vec
());
group
.bench_function
(
"backprop bench"
,
|
b
|
{
b
.iter
(||
{
async_std
::
task
::
block_on
(
async
{
r
.run
(
input_n
as
u64
,
hidden_n
as
u64
,
output_n
as
u64
,
input_vals
.to
(),
input_weights
.to
(),
hidden_weights
.to
(),
target
.to
(),
input_prev_weights
.to
(),
hidden_prev_weights
.to
(),
)
.await
});
})
});
}
criterion_group!
(
benches
,
backprop_bench
);
criterion_main!
(
benches
);
Loading