Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
1898e3e5
Unverified
Commit
1898e3e5
authored
Nov 07, 2023
by
kahmed10
Committed by
GitHub
Nov 07, 2023
Browse files
Echo driver command (#2377)
parent
a3cc2c7c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
17 deletions
+23
-17
src/driver/main.cpp
src/driver/main.cpp
+23
-17
No files found.
src/driver/main.cpp
View file @
1898e3e5
...
...
@@ -59,6 +59,13 @@ namespace migraphx {
namespace
driver
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
std
::
string
get_version
()
{
return
"MIGraphX Version: "
+
std
::
to_string
(
MIGRAPHX_VERSION_MAJOR
)
+
"."
+
std
::
to_string
(
MIGRAPHX_VERSION_MINOR
)
+
"."
+
std
::
to_string
(
MIGRAPHX_VERSION_PATCH
)
+
"."
+
MIGRAPHX_STRINGIZE
(
MIGRAPHX_VERSION_TWEAK
);
}
struct
loader
{
std
::
string
model
;
...
...
@@ -597,16 +604,6 @@ struct verify : command<verify>
}
};
struct
version
:
command
<
version
>
{
void
parse
(
const
argument_parser
&
)
{}
void
run
()
const
{
std
::
cout
<<
"MIGraphX Version: "
<<
MIGRAPHX_VERSION_MAJOR
<<
"."
<<
MIGRAPHX_VERSION_MINOR
<<
"."
<<
MIGRAPHX_VERSION_PATCH
<<
"."
MIGRAPHX_VERSION_TWEAK
<<
std
::
endl
;
}
};
struct
compile
:
command
<
compile
>
{
compiler
c
;
...
...
@@ -759,16 +756,14 @@ struct main_command
}
void
parse
(
argument_parser
&
ap
)
{
std
::
string
version_str
=
"MIGraphX Version: "
+
std
::
to_string
(
MIGRAPHX_VERSION_MAJOR
)
+
"."
+
std
::
to_string
(
MIGRAPHX_VERSION_MINOR
)
+
"."
+
std
::
to_string
(
MIGRAPHX_VERSION_PATCH
)
+
"."
MIGRAPHX_VERSION_TWEAK
;
std
::
string
version_str
=
get_version
();
ap
(
wrong_commands
,
{},
ap
.
metavar
(
"<command>"
),
ap
.
append
());
ap
(
nullptr
,
{
"-h"
,
"--help"
},
ap
.
help
(
"Show help"
),
ap
.
show_help
(
get_command_help
()));
ap
(
nullptr
,
{
"-v"
,
"--version"
},
ap
.
help
(
"Show MIGraphX version"
),
ap
.
show_help
(
version_str
));
ap
(
nullptr
,
{
"--ort-sha"
},
ap
.
help
(
"Show MIGraphX onnx runtime SHA"
));
// Trim command off of exe name
ap
.
set_exe_name
(
ap
.
get_exe_name
().
substr
(
0
,
ap
.
get_exe_name
().
size
()
-
5
));
...
...
@@ -811,7 +806,6 @@ using namespace migraphx::driver; // NOLINT
int
main
(
int
argc
,
const
char
*
argv
[])
{
std
::
vector
<
std
::
string
>
args
(
argv
+
1
,
argv
+
argc
);
// no argument, print the help infomration by default
if
(
args
.
empty
())
{
...
...
@@ -821,15 +815,27 @@ int main(int argc, const char* argv[])
auto
&&
m
=
get_commands
();
auto
cmd
=
args
.
front
();
if
(
cmd
==
"ort-sha"
)
if
(
cmd
==
"
--
ort-sha"
)
{
std
::
cout
<<
MIGRAPHX_ORT_SHA1
<<
std
::
endl
;
return
0
;
}
if
(
cmd
==
"-v"
or
cmd
==
"--version"
)
{
std
::
cout
<<
get_version
()
<<
std
::
endl
;
return
0
;
}
if
(
m
.
count
(
cmd
)
>
0
)
{
m
.
at
(
cmd
)(
argv
[
0
],
{
args
.
begin
()
+
1
,
args
.
end
()});
std
::
string
driver_invocation
=
std
::
string
(
argv
[
0
])
+
" "
+
migraphx
::
to_string_range
(
args
,
" "
);
std
::
cout
<<
"Running [ "
<<
get_version
()
<<
" ]: "
<<
driver_invocation
<<
std
::
endl
;
m
.
at
(
cmd
)(
argv
[
0
],
{
args
.
begin
()
+
1
,
args
.
end
()});
// run driver command found in commands map
std
::
cout
<<
"[ "
<<
get_version
()
<<
" ] Complete: "
<<
driver_invocation
<<
std
::
endl
;
}
else
{
...
...
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