18.2.212. PMIx_Resource_unit_create
PMIx_Resource_unit_create — Allocate and initialize an array of
pmix_resource_unit_t(5) structures.
18.2.212.1. SYNOPSIS
#include <pmix.h>
pmix_resource_unit_t* PMIx_Resource_unit_create(size_t n);
18.2.212.1.1. Python Syntax
No Python equivalent
18.2.212.2. INPUT PARAMETERS
n: Number of pmix_resource_unit_t(5) structures to allocate.
18.2.212.3. DESCRIPTION
Allocate a contiguous array of n pmix_resource_unit_t structures on the heap and initialize each element
as if by PMIx_Resource_unit_construct(3) — each element is zeroed and its
type field set to PMIX_DEVTYPE_UNKNOWN.
The returned array is owned by the caller and must be released with PMIx_Resource_unit_free(3), which frees the array storage.
18.2.212.4. RETURN VALUE
Returns a pointer to the newly allocated array of pmix_resource_unit_t structures, or NULL if n is zero or the
allocation fails.
18.2.212.5. NOTES
Because a request for zero elements returns NULL, callers should treat a
NULL return as either an out-of-memory condition or a zero-length request,
depending on the value passed for n.
18.2.212.6. EXAMPLES
Allocate and free an array:
pmix_resource_unit_t *array;
array = PMIx_Resource_unit_create(2);
/* ... populate and use array ... */
PMIx_Resource_unit_free(array, 2);