8
votes

I read somewhere that pinned memory in CUDA is scarce source. What is upper bound on pinned memory? In windows, in linux?

1
Pinned memory is memory guaranteed to be allocated on your main memory, unless there isn't enough room. The more RAM you have on your host machine the more pinned memory can be allocated. You can't have an exact number. - sj755
I think that is not correct..let's say I've 4GB RAM and if I allocate 3.5GB of memory using cudaHostAllloc() then we have around 500MB left then it may not possible for OS for manage within 500MB right? There must be some upper bound on such allocation. - username_4567
I was thinking this, yes. There's no way the OS can successfully allocate such a huge chunk of pinned memory with a single request. However, this limit may change with the amount of memory you have, although I can't confirm this. However, I do know that the maximum amount global memory that can be allocated at once does scale with the amount of global memory you have. I'm thinking allocating host memory works the same way. - sj755

1 Answers

7
votes

Pinned memory is just physical RAM in your system that is set aside and not allowed to be paged out by the OS. So once pinned, that amount of memory becomes unavailable to other processes (effectively reducing the memory pool available to rest of the OS).

The maximum pinnable memory therefore is determined by what other processes (other apps, the OS itself) are competing for system memory. What processes are concurrently running in either Windows or Linux (e.g. whether they themselves are pinning memory) will determine how much memory is available for you to pin at that particular time.