cpusetGetNodeList(3x)cpusetGetNodeList(3x)NAMEcpusetGetNodeList - get the list of nodes assigned to a cpuset
SYNOPSIS
#include <cpuset.h>
cpuset_NodeList_t *cpusetGetNodeList(char *qname);
DESCRIPTION
The cpusetGetNodeList function is used to obtain the list of nodes on
which on all CPU and memory resources are assigned to the cpuset. Only
processes running with a user ID or group ID that has read access
permissions on the permissions file can successfully execute this
function. The qname argument is the name of the specified cpuset.
The function returns a pointer to a structure of type cpuset_NodeList_t
(defined in <cpuset.h>). The function cpusetGetNodeList allocates the
memory for the structure and the user is responsible for freeing the
memory using the function cpusetFreeNodeList(3x). The cpuset_NodeList_t
structure looks similar to this:
typedef struct {
int count;
cnodeid_t *list;
} cpuset_NodeList_t;
count is the number of node IDs in the list. list references the memory
array that holds the list of node IDs. The memory for list is allocated
when the cpuset_NodeList_t is allocated and it is released when the
cpuset_NodeList_t structure is released.
EXAMPLES
This example obtains the list of nodes assigned to the cpuset mpi_set and
prints out the node ID values.
char *qname = "mpi_set";
cpuset_NodeList_t *nodes;
/* Get the list of nodes else print error & exit */
if ( !(nodes = cpusetGetNodeList(qname)) ) {
perror("cpusetGetNodeList");
exit(1);
}
if (nodes->count == 0) {
printf("CPUSET[%s] has 0 assigned nodes\n",
qname);
} else {
int i;
printf("CPUSET[%s] assigned nodes:\n",
qname);
Page 1
cpusetGetNodeList(3x)cpusetGetNodeList(3x)
for (i = 0; i < nodes->count; i++)
printf("NODE_ID[%d]\n", nodes->list[i]);
}
cpusetFreeNodeList(nodes);
NOTEScpusetGetNodeList is found in the library "libcpuset.so", and will be
loaded if the option -lcpuset is used with cc(1) or ld(1).
SEE ALSOcpuset(1), cpusetFreeNodeList(3x), cpuset(5).
DIAGNOSTICS
If successful, cpusetGetNodeList returns a pointer to a cpuset_NodeList_t
structure. If cpusetGetNodeList fails, it returns NULL and errno is set
to indicate the error. The possible values for errno include those
values as set by sysmp(2) and sbrk(2).
Page 2