Page 1 of 1

Using streams

Posted: Mon Mar 31, 2014 5:16 am
by dalal
Dear all,
How I can use stream in dependent routines calls, I mean by dependent that one routine need the results from the anothor. I have the following example code, but I don't get the correct results. There is any way to make it work properly.

cudaStream_t stream[2];
cudaStreamCreate( &stream[0] ) ;
cudaStreamCreate( &stream[1] ) ;

magmablasSetKernelStream(stream[0]);
magmablas_slacpy( MagmaUpperLower, M, N, d_H2s, M32, d_B, M232 );
magmablasSetKernelStream(stream[1]);
magma_sgeqrf_gpu( M2, M, d_B, M232, tau, d_T, &info);

cudaStreamDestroy( stream[0] ) ;
cudaStreamDestroy( stream[1] ) ;

Thanks

Re: Using streams

Posted: Mon Mar 31, 2014 1:35 pm
by mgates3
If there is a dependency, both functions should be scheduled on the same stream, or you need to use CUDA synchronization between the functions, e.g., cudaStreamSynchronize or cudaEventSynchronize.

The purpose of using different streams for functions would be if there was no dependency and thus the functions could run in parallel, which is not the case here.

-mark

Re: Using streams

Posted: Wed Apr 02, 2014 2:15 am
by dalal
Thanks for the info, very useful.