Using streams

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
dalal
Posts: 14
Joined: Thu Feb 20, 2014 4:30 am

Using streams

Post by dalal » Mon Mar 31, 2014 5:16 am

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

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: Using streams

Post by mgates3 » Mon Mar 31, 2014 1:35 pm

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

dalal
Posts: 14
Joined: Thu Feb 20, 2014 4:30 am

Re: Using streams

Post by dalal » Wed Apr 02, 2014 2:15 am

Thanks for the info, very useful.

Post Reply