MAGMA and CUDA streams
Posted: Wed Apr 23, 2014 5:02 pm
Hi,
I am trying to write code in which multiple CPU threads will perform GPU based operations in parallel. The matrix operations are listed below:
1. magma_sgemm/magma_dgemm
2. magmablas_sgeadd
3. cublasSaxpy
Based on what I have read, I can use the function magmablas_setkernelstream(a_cuda_stream) to set a kernel stream in which the operations will be performed. Can you please tell if all the above functions support cuda streams? I have also read that modern GPUs can allow upto 16 concurrent kernel launches. The code I am trying to write has a vector of vctors. Each vector will be of size N, and the number of vectorss will be 2N. N can be upto 10,000.
The way I am planning to do this (pseudocode):
Please let me know if this approach will yield good results. Is it very naive to just have the max. possible CUDA streams? Should I take into account the vector size to determine the number of streams to use?
Sincerely,
Vishal
I am trying to write code in which multiple CPU threads will perform GPU based operations in parallel. The matrix operations are listed below:
1. magma_sgemm/magma_dgemm
2. magmablas_sgeadd
3. cublasSaxpy
Based on what I have read, I can use the function magmablas_setkernelstream(a_cuda_stream) to set a kernel stream in which the operations will be performed. Can you please tell if all the above functions support cuda streams? I have also read that modern GPUs can allow upto 16 concurrent kernel launches. The code I am trying to write has a vector of vctors. Each vector will be of size N, and the number of vectorss will be 2N. N can be upto 10,000.
The way I am planning to do this (pseudocode):
Code: Select all
#pragma omp parallel for schedule(static,1) num_threads(16)
for(int i =0; i < 2N - 1; i++)
{
int thread_id = get_omp_thread_num();
create cuda stream using thread_id
set magam stream using the cuda stream created above
call magma functions to operate on vector[i] (listed above)
}
Sincerely,
Vishal