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
51d396cb
Commit
51d396cb
authored
Jun 17, 2022
by
wangshaojie6
Browse files
use odd method to getelapsedtime
parent
5f196e66
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
library/include/ck/library/host_tensor/device.hpp
library/include/ck/library/host_tensor/device.hpp
+17
-17
library/src/host_tensor/device.cpp
library/src/host_tensor/device.cpp
+3
-3
No files found.
library/include/ck/library/host_tensor/device.hpp
View file @
51d396cb
...
@@ -98,34 +98,34 @@ float launch_and_time_kernel(const StreamConfig& stream_config,
...
@@ -98,34 +98,34 @@ float launch_and_time_kernel(const StreamConfig& stream_config,
printf
(
"Start running %d times...
\n
"
,
nrepeat
);
printf
(
"Start running %d times...
\n
"
,
nrepeat
);
//
KernelTimer timer;
KernelTimer
timer
;
//
timer.Start();
timer
.
Start
();
hipEvent_t
start
,
stop
;
//
hipEvent_t start, stop;
hip_check_error
(
hipEventCreate
(
&
start
));
//
hip_check_error(hipEventCreate(&start));
hip_check_error
(
hipEventCreate
(
&
stop
));
//
hip_check_error(hipEventCreate(&stop));
float
total_time
=
0.0
f
;
//
float total_time = 0.0f;
for
(
int
i
=
0
;
i
<
nrepeat
;
++
i
)
for
(
int
i
=
0
;
i
<
nrepeat
;
++
i
)
{
{
hipExtLaunchKernelGGL
(
kernel
,
grid_dim
,
block_dim
,
0
,
nullptr
,
start
,
stop
,
0
,
kernel
<<<
grid_dim
,
block_dim
,
lds_byte
,
stream_config
.
stream_id_
>>>
(
args
...);
args
...);
//hipExtLaunchKernelGGL(kernel, grid_dim, block_dim, 0, nullptr, start, stop, 0,
// args...);
//kernel<<<grid_dim, block_dim, lds_byte, stream_config.stream_id_>>>(args...);
//hip_check_error(hipEventSynchronize(stop));
hip_check_error
(
hipEventSynchronize
(
stop
));
float
time
=
0.0
f
;
//
float time = 0.0f;
hip_check_error
(
hipEventElapsedTime
(
&
time
,
start
,
stop
));
//
hip_check_error(hipEventElapsedTime(&time, start, stop));
total_time
+=
time
;
//
total_time += time;
}
}
//
timer.End();
timer
.
End
();
//
return timer.GetElapsedTime() / nrepeat;
return
timer
.
GetElapsedTime
()
/
nrepeat
;
return
total_time
/
nrepeat
;
//
return total_time/nrepeat;
}
}
else
else
{
{
...
...
library/src/host_tensor/device.cpp
View file @
51d396cb
...
@@ -39,13 +39,13 @@ struct KernelTimerImpl
...
@@ -39,13 +39,13 @@ struct KernelTimerImpl
void
Start
()
void
Start
()
{
{
//
hip_check_error(hipDeviceSynchronize());
hip_check_error
(
hipDeviceSynchronize
());
//
hip_check_error(hipEventRecord(mStart, nullptr));
hip_check_error
(
hipEventRecord
(
mStart
,
nullptr
));
}
}
void
End
()
void
End
()
{
{
//
hip_check_error(hipEventRecord(mEnd, nullptr));
hip_check_error
(
hipEventRecord
(
mEnd
,
nullptr
));
hip_check_error
(
hipEventSynchronize
(
mEnd
));
hip_check_error
(
hipEventSynchronize
(
mEnd
));
}
}
...
...
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