Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
9d09c7e5
Commit
9d09c7e5
authored
Jul 03, 2018
by
Robert Kimball
Committed by
Scott Cyphers
Jul 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nbench cleanup (#1183)
* nbench cleanup * update style
parent
b6bc86bf
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
79 deletions
+21
-79
CMakeLists.txt
src/tools/nbench/CMakeLists.txt
+1
-4
benchmark.cpp
src/tools/nbench/benchmark.cpp
+9
-5
benchmark.hpp
src/tools/nbench/benchmark.hpp
+4
-3
nbench.cpp
src/tools/nbench/nbench.cpp
+7
-8
backend_performance.cpp
test/backend_performance.cpp
+0
-57
CMakeLists.txt
test/util/CMakeLists.txt
+0
-2
No files found.
src/tools/nbench/CMakeLists.txt
View file @
9d09c7e5
...
...
@@ -16,11 +16,10 @@
set
(
SRC
nbench.cpp
${
PROJECT_SOURCE_DIR
}
/test/util/
benchmark.cpp
benchmark.cpp
)
add_executable
(
nbench
${
SRC
}
)
add_dependencies
(
nbench ngraph
)
target_link_libraries
(
nbench ngraph
)
if
(
NGRAPH_CPU_ENABLE
)
...
...
@@ -36,6 +35,4 @@ if (NGRAPH_INTERPRETER_ENABLE)
target_link_libraries
(
nbench interpreter_backend
)
endif
()
include_directories
(
"
${
PROJECT_SOURCE_DIR
}
/test"
)
install
(
TARGETS nbench RUNTIME DESTINATION
${
NGRAPH_INSTALL_BIN
}
)
test/util
/benchmark.cpp
→
src/tools/nbench
/benchmark.cpp
View file @
9d09c7e5
...
...
@@ -15,14 +15,16 @@
*******************************************************************************/
#include <iomanip>
#include <random>
#include "benchmark.hpp"
#include "ngraph/file_util.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/runtime/backend.hpp"
#include "ngraph/runtime/tensor_view.hpp"
#include "ngraph/runtime/tensor_view.hpp"
#include "ngraph/serializer.hpp"
#include "ngraph/util.hpp"
#include "random.hpp"
using
namespace
std
;
using
namespace
ngraph
;
...
...
@@ -116,25 +118,27 @@ static default_random_engine s_random_engine;
template
<
typename
T
>
void
init_int_tv
(
shared_ptr
<
runtime
::
TensorView
>
tv
,
T
min
,
T
max
)
{
size_t
size
=
tv
->
get_element_count
();
uniform_int_distribution
<
T
>
dist
(
min
,
max
);
std
::
vector
<
T
>
vec
=
read_vector
<
T
>
(
tv
);
vector
<
T
>
vec
(
size
);
for
(
T
&
element
:
vec
)
{
element
=
dist
(
s_random_engine
);
}
write_vector
(
tv
,
vec
);
tv
->
write
(
vec
.
data
(),
0
,
vec
.
size
()
);
}
template
<
typename
T
>
void
init_real_tv
(
shared_ptr
<
runtime
::
TensorView
>
tv
,
T
min
,
T
max
)
{
size_t
size
=
tv
->
get_element_count
();
uniform_real_distribution
<
T
>
dist
(
min
,
max
);
std
::
vector
<
T
>
vec
=
read_vector
<
T
>
(
tv
);
vector
<
T
>
vec
(
size
);
for
(
T
&
element
:
vec
)
{
element
=
dist
(
s_random_engine
);
}
write_vector
(
tv
,
vec
);
tv
->
write
(
vec
.
data
(),
0
,
vec
.
size
()
);
}
static
void
random_init
(
shared_ptr
<
runtime
::
TensorView
>
tv
)
...
...
test/util
/benchmark.hpp
→
src/tools/nbench
/benchmark.hpp
View file @
9d09c7e5
...
...
@@ -17,11 +17,12 @@
#pragma once
#include <map>
#include <memory>
#include <string>
#include <vector>
#include <ngraph/function.hpp>
#include "ngraph/function.hpp"
#include "ngraph/runtime/performance_counter.hpp"
#include "test_tools.hpp"
/// performance test utilities
std
::
multimap
<
size_t
,
std
::
string
>
...
...
src/tools/nbench/nbench.cpp
View file @
9d09c7e5
...
...
@@ -21,15 +21,14 @@
// sample models are under ../../test/models
#include <fstream>
#include <ngraph/file_util.hpp>
#include <ngraph/file_util.hpp>
#include <ngraph/pass/manager.hpp>
#include <ngraph/pass/visualize_tree.hpp>
#include <ngraph/runtime/backend.hpp>
#include <ngraph/util.hpp>
#include "util/benchmark.hpp"
#include "util/test_tools.hpp"
#include "benchmark.hpp"
#include "ngraph/file_util.hpp"
#include "ngraph/pass/manager.hpp"
#include "ngraph/pass/visualize_tree.hpp"
#include "ngraph/runtime/backend.hpp"
#include "ngraph/serializer.hpp"
#include "ngraph/util.hpp"
using
namespace
std
;
using
namespace
ngraph
;
...
...
test/backend_performance.cpp
View file @
9d09c7e5
...
...
@@ -28,69 +28,12 @@
#include "ngraph/runtime/backend.hpp"
#include "ngraph/serializer.hpp"
#include "ngraph/util.hpp"
#include "util/benchmark.hpp"
#include "util/random.hpp"
#include "util/test_tools.hpp"
using
namespace
std
;
using
namespace
ngraph
;
TEST
(
benchmark
,
mxnet_mnist_mlp_forward
)
{
const
string
json_path
=
file_util
::
path_join
(
SERIALIZED_ZOO
,
"mxnet/mnist_mlp_forward.json"
);
run_benchmark
(
json_path
,
"CPU"
,
1000
);
}
TEST
(
benchmark
,
gpu_mxnet_mnist_mlp_forward
)
{
const
string
json_path
=
file_util
::
path_join
(
SERIALIZED_ZOO
,
"mxnet/mnist_mlp_forward.json"
);
run_benchmark
(
json_path
,
"GPU"
,
1000
);
}
TEST
(
benchmark
,
mxnet_10_bucket_lstm
)
{
const
string
json_path
=
file_util
::
path_join
(
SERIALIZED_ZOO
,
"mxnet/10_bucket_LSTM.json"
);
run_benchmark
(
json_path
,
"CPU"
,
10
);
}
TEST
(
benchmark
,
mxnet_lstm_backward
)
{
const
string
json_path
=
file_util
::
path_join
(
SERIALIZED_ZOO
,
"mxnet/LSTM_backward.json"
);
run_benchmark
(
json_path
,
"CPU"
,
10
);
}
TEST
(
benchmark
,
mxnet_lstm_forward
)
{
const
string
json_path
=
file_util
::
path_join
(
SERIALIZED_ZOO
,
"mxnet/LSTM_forward.json"
);
run_benchmark
(
json_path
,
"CPU"
,
10
);
}
TEST
(
benchmark
,
mxnet_seq2seq_forward
)
{
const
string
json_path
=
file_util
::
path_join
(
SERIALIZED_ZOO
,
"mxnet/Seq2Seq_forward.json"
);
run_benchmark
(
json_path
,
"CPU"
,
10
);
}
TEST
(
benchmark
,
mxnet_seq2seq_backward
)
{
const
string
json_path
=
file_util
::
path_join
(
SERIALIZED_ZOO
,
"mxnet/Seq2Seq_backward.json"
);
run_benchmark
(
json_path
,
"CPU"
,
10
);
}
TEST
(
benchmark
,
mxnet_sockeye_seq2seq_forward
)
{
const
string
json_path
=
file_util
::
path_join
(
SERIALIZED_ZOO
,
"mxnet/Sockeye_Seq2Seq_forward.json"
);
run_benchmark
(
json_path
,
"CPU"
,
10
);
}
TEST
(
benchmark
,
mxnet_sockeye_seq2seq_backward
)
{
const
string
json_path
=
file_util
::
path_join
(
SERIALIZED_ZOO
,
"mxnet/Sockeye_Seq2Seq_backward.json"
);
run_benchmark
(
json_path
,
"CPU"
,
10
);
}
//
// Benchmarks a graph that concatenates six 32x1x200 arrays along the middle axis.
//
...
...
test/util/CMakeLists.txt
View file @
9d09c7e5
...
...
@@ -18,7 +18,6 @@ set (SRC
autodiff/backprop_function.cpp
all_close_f.cpp
test_tools.cpp
benchmark.cpp
test_control.cpp
)
...
...
@@ -32,6 +31,5 @@ include_directories(
add_library
(
ngraph_test_util SHARED
${
SRC
}
)
set_target_properties
(
ngraph_test_util PROPERTIES VERSION
${
NGRAPH_VERSION
}
SOVERSION
${
NGRAPH_API_VERSION
}
)
target_link_libraries
(
ngraph_test_util ngraph libgtest
)
add_dependencies
(
ngraph_test_util ngraph libgtest
)
install
(
TARGETS ngraph_test_util DESTINATION
${
NGRAPH_INSTALL_LIB
}
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment