# Is it possible to measure memory transfer time and kernel execution time in ITK + GPU?

**URL:** https://discourse.itk.org/t/is-it-possible-to-measure-memory-transfer-time-and-kernel-execution-time-in-itk-gpu/4261
**Category:** Algorithms
**Tags:** gpu
**Created:** [July 13, 2021, 7:12pm UTC](https://discourse.itk.org/t/is-it-possible-to-measure-memory-transfer-time-and-kernel-execution-time-in-itk-gpu/4261 "2021-07-13T19:12:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Rafael\_Palomar](https://discourse.itk.org/user_avatar/discourse.itk.org/rafael_palomar/32/1535_2.png) [@Rafael\_Palomar](https://discourse.itk.org/u/Rafael_Palomar)
#### Post date: [July 13, 2021, 7:12pm UTC](https://discourse.itk.org/t/is-it-possible-to-measure-memory-transfer-time-and-kernel-execution-time-in-itk-gpu/4261/1 "2021-07-13T19:12:55Z")

</div>

When benchmarking GPU algorithms it is important to measure kernel execution time separated from memory transfer times (CPU-\>GPU and GPU-\>CPU). Is it possible to measure these times separately for existing algorithms (e.g., GPUBinaryThresholdImageFilter?). Thanks in advance.

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [July 13, 2021, 8:01pm UTC](https://discourse.itk.org/t/is-it-possible-to-measure-memory-transfer-time-and-kernel-execution-time-in-itk-gpu/4261/2 "2021-07-13T20:01:06Z")

</div>

Hi @Rafael_Palomar ,

Welcome to the ITK community! 🌞

To separate the memory transfer times, call `UpdateBuffers()` on the images.

Here is an example:

> <https://github.com/InsightSoftwareConsortium/ITK/blob/fb4fc0168751c21de4b085063272988c45ae9788/Modules/Filtering/GPUSmoothing/wrapping/test/itkGPUMeanImageFilterTest.py>

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [July 14, 2021, 2:22pm UTC](https://discourse.itk.org/t/is-it-possible-to-measure-memory-transfer-time-and-kernel-execution-time-in-itk-gpu/4261/3 "2021-07-14T14:22:49Z")

</div>

2 posts were split to a new topic: [GPU support in Python packages](https://discourse.itk.org/t/gpu-support-in-python-packages/4267)

---

<div class="post-metadata">

### Author: ![Rafael\_Palomar](https://discourse.itk.org/user_avatar/discourse.itk.org/rafael_palomar/32/1535_2.png) [@Rafael\_Palomar](https://discourse.itk.org/u/Rafael_Palomar)
#### Post date: [July 14, 2021, 8:21am UTC](https://discourse.itk.org/t/is-it-possible-to-measure-memory-transfer-time-and-kernel-execution-time-in-itk-gpu/4261/4 "2021-07-14T08:21:36Z")

</div>

Thank you, @matt.mccormick! That solved the issue.
