# cuBLAS and dynamic parallelism

**URL:** <https://forums.developer.nvidia.com/t/cublas-and-dynamic-parallelism/30603>\
**Category:** CUDA Programming and Performance\
**Created:** [August 28, 2013, 1:10pm UTC](https://forums.developer.nvidia.com/t/cublas-and-dynamic-parallelism/30603 "2013-08-28T13:10:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eyalhir74](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@eyalhir74](https://forums.developer.nvidia.com/u/eyalhir74)\
**Post date:** [August 28, 2013, 1:10pm UTC](https://forums.developer.nvidia.com/t/cublas-and-dynamic-parallelism/30603/1 "2013-08-28T13:10:50Z")

</div>

Hi,  
Does anyone know if the cuBLAS functions that are called inside kernels running on the device (as in Dynamic Parallelism) cause some sort of device synchronization?

What if I want to run couple of kernels concurrently on the same device using multiple streams, will the cuBLAS functions inside the kernel, cause a device sync, hence no concurrency be achieved??

Is there a way around this?

thanks

---

<div class="post-metadata">

**Author:** ![JFSebastian](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/jfsebastian/32/75602_2.png) [@JFSebastian](https://forums.developer.nvidia.com/u/JFSebastian)\
**Post date:** [August 29, 2013, 8:20am UTC](https://forums.developer.nvidia.com/t/cublas-and-dynamic-parallelism/30603/2 "2013-08-29T08:20:57Z")

</div>

With the exception of few routines (returning a scalar value or involging CPU\<-\>GPU transactions), most of cuBLAS routines are asynchronous when called from the host. However, I have never used them called within a kernel, so I do not know if they do or do not keep their asynchronous behavior. Perhaps, if none is definitely answering your question, it is worth a try and profile by yourself your code by the Visual Profiler to see if you observe concurrency…

---

<div class="post-metadata">

**Author:** ![eyalhir74](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@eyalhir74](https://forums.developer.nvidia.com/u/eyalhir74)\
**Post date:** [August 29, 2013, 10:17am UTC](https://forums.developer.nvidia.com/t/cublas-and-dynamic-parallelism/30603/3 "2013-08-29T10:17:53Z")

</div>

Thanks. Yes I’ve run it through the profiler. It seems that the device is synchronized from the profiler output. I wanted to be sure and see if there’s a work around to that and understand why it is so.

I’ve just took the cdpLUDecomposition sample and run it on two streams concurrently - that causes sync in the profiler.

---

<div class="post-metadata">

**Author:** ![eyalhir74](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@eyalhir74](https://forums.developer.nvidia.com/u/eyalhir74)\
**Post date:** [August 30, 2013, 3:47am UTC](https://forums.developer.nvidia.com/t/cublas-and-dynamic-parallelism/30603/4 "2013-08-30T03:47:30Z")

</div>

The LU sample code contains a call to cublasIzamax. This function caused the synchronization  
as it returns a value.  
Replacing this function by a custom kernel to find the max solved the problem and the LU  
can be run on multiple streams concurrently.
