Using streams

Open discussion for MAGMA

Using streams

Postby 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
dalal
 
Posts: 9
Joined: Thu Feb 20, 2014 4:30 am

Re: Using streams

Postby 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
mgates3
 
Posts: 427
Joined: Fri Jan 06, 2012 2:13 pm

Re: Using streams

Postby dalal » Wed Apr 02, 2014 2:15 am

Thanks for the info, very useful.
dalal
 
Posts: 9
Joined: Thu Feb 20, 2014 4:30 am


Return to User discussion

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

cron