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.
cudaMallocHost: Allocates page-locked memory on the host in duncantl/RCUDA: R Bindings for the CUDA Library for GPU Computing.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With