table of contents
| PMIX_RESOURCE_UNIT_CREATE(3) | OpenPMIx | PMIX_RESOURCE_UNIT_CREATE(3) |
PMIx_Resource_unit_create — Allocate and initialize an array of pmix_resource_unit_t(5) <#man5-pmix-resource-unit-t> structures.
SYNOPSIS¶
#include <pmix.h> pmix_resource_unit_t* PMIx_Resource_unit_create(size_t n);
Python Syntax¶
No Python equivalent
INPUT PARAMETERS¶
- •
- n: Number of pmix_resource_unit_t(5) <#man5-pmix-resource-unit-t> structures to allocate.
DESCRIPTION¶
Allocate a contiguous array of n pmix_resource_unit_t <#man5-pmix-resource-unit-t> structures on the heap and initialize each element as if by PMIx_Resource_unit_construct(3) <#man3-pmix-resource-unit-construct> — 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) <#man3-pmix-resource-unit-free>, which frees the array storage.
RETURN VALUE¶
Returns a pointer to the newly allocated array of pmix_resource_unit_t <#man5-pmix-resource-unit-t> structures, or NULL if n is zero or the allocation fails.
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.
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);
See also:
Copyright¶
2014-2026, OpenPMIx Community
| November 21, 2026 |