21.2.186. PMIx_Cpuset_create

PMIx_Cpuset_create — Allocate and initialize an array of pmix_cpuset_t(5) structures.

21.2.186.1. SYNOPSIS

#include <pmix.h>

pmix_cpuset_t* PMIx_Cpuset_create(size_t n);

21.2.186.1.1. Python Syntax

No Python equivalent

21.2.186.2. INPUT PARAMETERS

21.2.186.3. DESCRIPTION

Allocate a contiguous array of n pmix_cpuset_t structures on the heap and construct each element (zeroing its source and bitmap fields).

If n is zero, no allocation is performed and NULL is returned.

21.2.186.4. RETURN VALUE

Returns a pointer to the newly allocated and initialized array, or NULL if n is zero or the allocation fails.

21.2.186.5. NOTES

An array obtained from PMIx_Cpuset_create must be released with PMIx_Cpuset_free(3), which destructs every element and frees the array storage itself. Pass the same count n used at creation.

The convenience macro PMIX_CPUSET_CREATE is provided as a wrapper around this function.

21.2.186.6. EXAMPLES

Create and later release an array of cpusets:

pmix_cpuset_t *array;

array = PMIx_Cpuset_create(2);
/* ... populate and use the cpusets ... */
PMIx_Cpuset_free(array, 2);