GPU MAGMA: When to use pinned memory allocation

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
wirawan0
Posts: 4
Joined: Sat Apr 11, 2015 11:42 am

GPU MAGMA: When to use pinned memory allocation

Post by wirawan0 » Sun Apr 12, 2015 11:35 pm

Hi,

I am a newbie with GPU & MAGMA programming. I see that MAGMA (and Cuda) provide pinned host memory allocation (magma_*alloc_pinned & cudaMallocHost). When do I need to use pinned malloc instead of regular malloc? I cannot see any indication in the MAGMA documentation or a pattern I could recognize in the testing directory. My understanding is that pinned malloc allows for the best memory transfer speed between GPU and CPU. Is this correct?

Wirawan

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

Re: GPU MAGMA: When to use pinned memory allocation

Post by mgates3 » Tue Apr 14, 2015 12:40 am

Yes, pinned memory allows for overlapping CPU work with data transfers, which makes the algorithms faster.

Generally, the testers allocate pinned memory for calling MAGMA functions, while memory that is used only for LAPACK functions doesn't need to be pinned. However, allocating pinned memory can be somewhat expensive, especially for large allocations, so you may want to test with and without pinning to see the performance difference.

-mark

Post Reply