CUDAMalloc question

Hi,
When I ask for a big chunk of memory via cudaMalloc, is the memory allocated
contiguously or possibly broken down to multiple virtual pages in GPU ram?
I mainly ask because of the following scenario: say I have a GPU with 4GB Ram.
I then allocate many 50-100MB allocations with a total of, say, 2GB. Could it be that
the memory is fragmented now? then I try to allocate a 1.7GB in one cudaMalloc call, will
it succeed? will it be allocated in one contiguous block or broken down?

thanks
Eyal

A single allocation returned by cudaMalloc should be physically contiguous.

Yes, it could be.

don’t know

If it succeeds, it should be allocated in one contiguous block.

Thanks Robert!
So if for example I allocate a lot of 100MBs of chunks (counting for 1/2 of the GPU ram, spread poorly), basically the next time I will try to allocate, say, a 105MB chunk, it might be that because of fragmentation this allocation would fail? even though there’s ton of free space??

So no virtual paging is done to prevent this from happening?

thanks
Eyal

Yes, fragmentation can result in an allocation failure.

Hi Robert,
What about pinned memory? is the pinned memory allocated is in one chunk or multiple virtual pages that not necessarily exist as a contiguous pages in host memory?

Hi Robert,
What about pinned memory? is the pinned memory allocated is in one chunk or multiple virtual pages that not necessarily exist as a contiguous pages in host memory?

Hi Robert,
What about pinned memory? is the pinned memory allocated is in one chunk or multiple virtual pages that not necessarily exist as a contiguous pages in host memory?

Hi Robert,
What about pinned memory? is the pinned memory allocated is in one chunk or multiple virtual pages that not necessarily exist as a contiguous pages in host memory?

Hi Robert,
What about pinned memory? is the pinned memory allocated is in one chunk or multiple virtual pages that not necessarily exist as a contiguous pages in host memory?

Hi Robert,
What about pinned memory? is the pinned memory allocated is in one chunk or multiple virtual pages that not necessarily exist as a contiguous pages in host memory?

Hi Robert,
What about pinned memory? is the pinned memory allocated is in one chunk or multiple virtual pages that not necessarily exist as a contiguous pages in host memory?