Question

I have a NUMA machine of 2 nodes. I want to allocate the two halves of an array on the two nodes respectively. How can I do that?

Please note that by "half" I mean a continuous chunk of virtual memory. I found the function numa_alloc_interleaved, but it doesn't satisfy my requirement.

Was it helpful?

Solution

You have a couple of choices.

You can have one piece of code that uses numa_alloc_onnode to allocate a block on each node you want to use, then give control/ownership of that block to the code running on that node.

Alternatively, you can start the code on each node, then have each node's code allocate its own memory locally using numa_alloc_local.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top