Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
composable_kernel
Commits
8e71cad0
Commit
8e71cad0
authored
Sep 05, 2022
by
Po-Yen, Chen
Browse files
Allow specify problem through command line argument
parent
19147f59
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
example/36_elementwise_permute/common.hpp
example/36_elementwise_permute/common.hpp
+40
-0
No files found.
example/36_elementwise_permute/common.hpp
View file @
8e71cad0
...
...
@@ -39,5 +39,45 @@ using PassThrough = ck::tensor_operation::element_wise::PassThrough;
inline
bool
parse_cmd_args
(
int
argc
,
char
*
argv
[],
ExecutionConfig
&
config
,
Problem
&
problem
)
{
constexpr
int
num_execution_config_args
=
2
;
constexpr
int
num_problem_args
=
8
;
assert
(
num_problem_args
==
problem
.
shape
.
size
()
+
problem
.
axes
.
size
());
if
(
argc
==
1
)
{
// use default case
}
else
if
(
argc
==
1
+
num_execution_config_args
)
{
config
.
do_verification
=
std
::
stoi
(
argv
[
1
]);
config
.
time_kernel
=
std
::
stoi
(
argv
[
2
]);
}
else
if
(
argc
==
1
+
num_execution_config_args
+
num_problem_args
)
{
config
.
do_verification
=
std
::
stoi
(
argv
[
1
]);
config
.
time_kernel
=
std
::
stoi
(
argv
[
2
]);
// read shape
for
(
std
::
size_t
idx
=
0
;
idx
<
problem
.
shape
.
size
();
++
idx
)
{
problem
.
shape
[
idx
]
=
std
::
stoi
(
argv
[
idx
+
3
]);
}
// read axes
for
(
std
::
size_t
idx
=
0
;
idx
<
problem
.
axes
.
size
();
++
idx
)
{
problem
.
axes
[
idx
]
=
std
::
stoi
(
argv
[
idx
+
problem
.
shape
.
size
()
+
3
]);
}
}
else
{
std
::
cerr
<<
"arg1: verification (0=no, 1=yes)"
<<
std
::
endl
<<
"arg2: time kernel (0=no, 1=yes)"
<<
std
::
endl
<<
"arg3 ~ arg6: shape for 4D tensor"
<<
std
::
endl
<<
"arg7 ~ arg10: axes to permute"
<<
std
::
endl
;
return
false
;
}
return
true
;
}
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