Differences CudaMalloc vs Malloc

What is the difference between CudaMalloc and Malloc? Why would I use one over the other?

cudaMalloc allocates memory on the device, whereas malloc allocates on the host.

device meaning the GPU and host meaning CPU?

Sorry if my last post we not descriptive enough -

Does the device mean that it accesses the ram on the GPU and the host means that it accesses the ram controlled by the CPU?

So, Malloc will create a storage place in CPU controlled ram and cudaMalloc will create a storage place in GPU controlled ram?

Hi,

Yes that is correct.

Thanks

Now malloc can also be used on the device: Dynamic Global Memory Allocation and Operations. More details on this can be found at Memory Allocation and Lifetime:

cudaMalloc() and cudaFree() have distinct semantics between the host and device environments. When invoked from the host, cudaMalloc() allocates a new region from unused device memory. When invoked from the device runtime these functions map to device-side malloc() and free() .