I've set up my code to carefully load and process data locally on my NUMA system. I think. That is, for debugging purposes I'd really like to be able to use the pointer addresses being accessed inside a particular function, which have been set up by many other functions, to directly identify the NUMA node(s) that the memory pointed at is residing on, so I can check that everything is located where it should be located. Is this possible?
I found this request on msdn http://social.msdn.microsoft.com/Forums/en-US/parallelcppnative/thread/37a02e17-e160-48d9-8625-871ff6b21f72 for the same thing, but the answer uses QueryWorkingSetEx() which appears to be Windows specific. Can this be done on Linux? I'm on Debian Squeeze, to be precise.
Thanks.
NUMA Enabled Systems If NUMA is enabled on BIOS, then execute the command 'numactl –hardware' to list inventory of available nodes on the system. Below is example output of numactl –hardware on a system which has NUMA.
Right click on the instance in the object explorer and select the CPU tab. Expand the “ALL” option. However many NUMA nodes are shown is the number of NUMA nodes that you have as shown below. You can even expand each NUMA nodes to see which logical processors are in each NUMA node.
Non-Uniform Memory Access (NUMA) refers to multiprocessor systems whose memory is divided into multiple memory nodes. The access time of a memory node depends on the relative locations of the accessing CPU and the accessed node.
The Linux scheduler is aware of the NUMA topology of the platform–embodied in the “scheduling domains” data structures [see Documentation/scheduler/sched-domains. txt]–and the scheduler attempts to minimize task migration to distant scheduling domains.
There is an move_pages
function in -lnuma
: http://linux.die.net/man/2/move_pages
which can report current state of address(page) to node mappings:
nodes can also be NULL, in which case move_pages() does not move any pages but instead will return the node where each page currently resides, in the status array. Obtaining the status of each page may be necessary to determine pages that need to be moved.
So, call may be like:
void * ptr_to_check = your_address;
/*here you should align ptr_to_check to page boundary */
int status[1];
int ret_code;
status[0]=-1;
ret_code=move_pages(0 /*self memory */, 1, &ptr_to_check,
NULL, status, 0);
printf("Memory at %p is at %d node (retcode %d)\n", ptr_to_check, status[0], ret_code);
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