# why the running time of CPU and GPU are same, while i use itkRWSegmentationFilter and itkCudaRWSegmentationFilter

**URL:** <https://discourse.itk.org/t/why-the-running-time-of-cpu-and-gpu-are-same-while-i-use-itkrwsegmentationfilter-and-itkcudarwsegmentationfilter/2959>\
**Category:** Uncategorized\
**Created:** [April 17, 2020, 3:02am UTC](https://discourse.itk.org/t/why-the-running-time-of-cpu-and-gpu-are-same-while-i-use-itkrwsegmentationfilter-and-itkcudarwsegmentationfilter/2959 "2020-04-17T03:02:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![KaryLiang](https://discourse.itk.org/user_avatar/discourse.itk.org/karyliang/32/1384_2.png) [@KaryLiang](https://discourse.itk.org/u/KaryLiang)\
**Post date:** [April 17, 2020, 3:02am UTC](https://discourse.itk.org/t/why-the-running-time-of-cpu-and-gpu-are-same-while-i-use-itkrwsegmentationfilter-and-itkcudarwsegmentationfilter/2959/1 "2020-04-17T03:02:31Z")

</div>

code from:[GitHub - enricperera/itkRWSegmentationFilter: ITK-like filter for image segmentation using the random walker algorithm](https://github.com/enricperera/itkRWSegmentationFilter)  
I run the code itkRWSegmentationFilter successful in CPU, but there has some error when i run itkCudaRWSegmentationFilter in GPU, like that:  
**BiCStab failed with error-1**  
so, i try to comment out these codes in itkCudaRWSegmentationFilter.hxx,lines 389~393.

> 

```
// Call CUDA BiCGStab solver
bicgstab_exit_status = this->BiCGStab(unmarkedLength, nnz);
if (bicgstab_exit_status != 0)
{
  std::cout << "BiCStab failed with error" << bicgstab_exit_status << std::endl;
  return;
}

```

> 

finally i get the same segmentation result and same running time in CPU and GPU.  
So my questions are:

- Are changes to the code the cause of this problem?
- How to solve the problem of CPU and GPU running time?

Thanks in advance!  
Kary
