Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any difference between cudaMallocHost() and cudaHostAlloc() without special flags?

In CUDA, I'm wondering about the difference between cudaMallocHost() and cudaHostAlloc().

Their respective summaries in the API reference say:

  • cudaMallocHost(): "Allocates page-locked memory on the host."
  • cudaHostAlloc(): "Allocates page-locked memory on the host."

And the further description seems to only be the additional flags one can specify for cudaHostAlloc(). Is the former kept simply for backwards-compatibility or is there an actual difference between them?

PS - Let's assume CUDA 6.5 and later.

like image 720
einpoklum Avatar asked Feb 21 '16 12:02

einpoklum


People also ask

What is cudaMallocHost?

cudaMallocHost: Allocates page-locked memory on the host in duncantl/RCUDA: R Bindings for the CUDA Library for GPU Computing.

For what purpose cudaMalloc function is used?

cudaMalloc is a function that can be called from the host or the device to allocate memory on the device, much like malloc for the host. The memory allocated with cudaMalloc must be freed with cudaFree.


1 Answers

To the best of my knowledge they are the same when default flags are used for cudaHostAlloc and the call runs on a UVA platform. When the unified virtual address model was introduced, there was the necessity to expand the API to allow for portable memory and other new features, and it seems rather than fiddling with the existing function, a new "Swiss Army knife" style API was introduced instead.

like image 164
2 revs Avatar answered Sep 23 '22 00:09

2 revs