18.2.184. PMIx_Cpuset_create

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

18.2.184.1. SYNOPSIS

#include <pmix.h>

pmix_cpuset_t* PMIx_Cpuset_create(size_t n);

18.2.184.1.1. Python Syntax

No Python equivalent

18.2.184.2. INPUT PARAMETERS

18.2.184.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.

18.2.184.4. RETURN VALUE

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

18.2.184.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.

18.2.184.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);