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
db594969
Commit
db594969
authored
Apr 19, 2019
by
Robert Kimball
Committed by
Scott Cyphers
Apr 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add option to nbench to generate only a dot file (#2781)
parent
57d637bc
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
4 deletions
+17
-4
visualize_tree.cpp
src/ngraph/pass/visualize_tree.cpp
+5
-1
visualize_tree.hpp
src/ngraph/pass/visualize_tree.hpp
+4
-1
nbench.cpp
src/tools/nbench/nbench.cpp
+8
-2
No files found.
src/ngraph/pass/visualize_tree.cpp
View file @
db594969
...
@@ -65,9 +65,10 @@ bool pass::VisualizeTree::run_on_module(vector<shared_ptr<Function>>& functions)
...
@@ -65,9 +65,10 @@ bool pass::VisualizeTree::run_on_module(vector<shared_ptr<Function>>& functions)
return
false
;
return
false
;
}
}
pass
::
VisualizeTree
::
VisualizeTree
(
const
string
&
file_name
,
node_modifiers_t
nm
)
pass
::
VisualizeTree
::
VisualizeTree
(
const
string
&
file_name
,
node_modifiers_t
nm
,
bool
dot_only
)
:
m_name
{
file_name
}
:
m_name
{
file_name
}
,
m_node_modifiers
{
nm
}
,
m_node_modifiers
{
nm
}
,
m_dot_only
(
dot_only
)
{
{
}
}
...
@@ -177,6 +178,8 @@ void pass::VisualizeTree::render() const
...
@@ -177,6 +178,8 @@ void pass::VisualizeTree::render() const
out
<<
"}
\n
"
;
out
<<
"}
\n
"
;
out
.
close
();
out
.
close
();
if
(
!
m_dot_only
)
{
#ifndef _WIN32
#ifndef _WIN32
stringstream
ss
;
stringstream
ss
;
ss
<<
"dot -T"
<<
get_file_ext
()
<<
" "
<<
dot_file
<<
" -o "
<<
m_name
;
ss
<<
"dot -T"
<<
get_file_ext
()
<<
" "
<<
dot_file
<<
" -o "
<<
m_name
;
...
@@ -188,4 +191,5 @@ void pass::VisualizeTree::render() const
...
@@ -188,4 +191,5 @@ void pass::VisualizeTree::render() const
}
}
#endif
#endif
}
}
}
}
}
src/ngraph/pass/visualize_tree.hpp
View file @
db594969
...
@@ -41,7 +41,9 @@ class ngraph::pass::VisualizeTree : public ModulePass
...
@@ -41,7 +41,9 @@ class ngraph::pass::VisualizeTree : public ModulePass
public
:
public
:
using
node_modifiers_t
=
using
node_modifiers_t
=
std
::
function
<
void
(
const
Node
&
node
,
std
::
vector
<
std
::
string
>&
attributes
)
>
;
std
::
function
<
void
(
const
Node
&
node
,
std
::
vector
<
std
::
string
>&
attributes
)
>
;
VisualizeTree
(
const
std
::
string
&
file_name
,
node_modifiers_t
nm
=
nullptr
);
VisualizeTree
(
const
std
::
string
&
file_name
,
node_modifiers_t
nm
=
nullptr
,
bool
dot_only
=
false
);
bool
run_on_module
(
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
Function
>>&
)
override
;
bool
run_on_module
(
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
Function
>>&
)
override
;
static
std
::
string
get_file_ext
();
static
std
::
string
get_file_ext
();
...
@@ -57,4 +59,5 @@ private:
...
@@ -57,4 +59,5 @@ private:
std
::
unordered_map
<
std
::
type_index
,
std
::
function
<
void
(
const
Node
&
,
std
::
ostream
&
ss
)
>>
std
::
unordered_map
<
std
::
type_index
,
std
::
function
<
void
(
const
Node
&
,
std
::
ostream
&
ss
)
>>
m_ops_to_details
;
m_ops_to_details
;
node_modifiers_t
m_node_modifiers
=
nullptr
;
node_modifiers_t
m_node_modifiers
=
nullptr
;
bool
m_dot_only
;
};
};
src/tools/nbench/nbench.cpp
View file @
db594969
...
@@ -197,6 +197,7 @@ int main(int argc, char** argv)
...
@@ -197,6 +197,7 @@ int main(int argc, char** argv)
bool
visualize
=
false
;
bool
visualize
=
false
;
int
warmup_iterations
=
1
;
int
warmup_iterations
=
1
;
bool
copy_data
=
true
;
bool
copy_data
=
true
;
bool
dot_file
=
false
;
for
(
size_t
i
=
1
;
i
<
argc
;
i
++
)
for
(
size_t
i
=
1
;
i
<
argc
;
i
++
)
{
{
...
@@ -237,6 +238,10 @@ int main(int argc, char** argv)
...
@@ -237,6 +238,10 @@ int main(int argc, char** argv)
{
{
visualize
=
true
;
visualize
=
true
;
}
}
else
if
(
arg
==
"--dot"
)
{
dot_file
=
true
;
}
else
if
(
arg
==
"-d"
||
arg
==
"--directory"
)
else
if
(
arg
==
"-d"
||
arg
==
"--directory"
)
{
{
directory
=
argv
[
++
i
];
directory
=
argv
[
++
i
];
...
@@ -294,6 +299,7 @@ OPTIONS
...
@@ -294,6 +299,7 @@ OPTIONS
--timing_detail Gather detailed timing
--timing_detail Gather detailed timing
-w|--warmup_iterations Number of warm-up iterations
-w|--warmup_iterations Number of warm-up iterations
--no_copy_data Disable copy of input/result data every iteration
--no_copy_data Disable copy of input/result data every iteration
--dot Generate graphviz dot file
)###"
;
)###"
;
return
1
;
return
1
;
}
}
...
@@ -339,10 +345,10 @@ OPTIONS
...
@@ -339,10 +345,10 @@ OPTIONS
{
{
shared_ptr
<
Function
>
f
=
deserialize
(
model
);
shared_ptr
<
Function
>
f
=
deserialize
(
model
);
auto
model_file_name
=
ngraph
::
file_util
::
get_file_name
(
model
)
+
std
::
string
(
"."
)
+
auto
model_file_name
=
ngraph
::
file_util
::
get_file_name
(
model
)
+
std
::
string
(
"."
)
+
pass
::
VisualizeTree
::
get_file_ext
(
);
(
dot_file
?
"dot"
:
pass
::
VisualizeTree
::
get_file_ext
()
);
pass
::
Manager
pass_manager
;
pass
::
Manager
pass_manager
;
pass_manager
.
register_pass
<
pass
::
VisualizeTree
>
(
model_file_name
);
pass_manager
.
register_pass
<
pass
::
VisualizeTree
>
(
model_file_name
,
nullptr
,
true
);
pass_manager
.
run_passes
(
f
);
pass_manager
.
run_passes
(
f
);
}
}
...
...
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