table of contents
| PMIX_DEVICE_DISTANCE_CREATE(3) | OpenPMIx | PMIX_DEVICE_DISTANCE_CREATE(3) |
PMIx_Device_distance_create — Allocate and initialize an array of pmix_device_distance_t(5) <#man5-pmix-device-distance-t> structures.
SYNOPSIS¶
#include <pmix.h> pmix_device_distance_t* PMIx_Device_distance_create(size_t n);
Python Syntax¶
No Python equivalent
INPUT PARAMETERS¶
- •
- n: Number of pmix_device_distance_t(5) <#man5-pmix-device-distance-t> structures to allocate in the array.
DESCRIPTION¶
Allocate a contiguous array of n pmix_device_distance_t <#man5-pmix-device-distance-t> structures on the heap and construct each element, as though PMIx_Device_distance_construct(3) <#man3-pmix-device-distance-construct> had been called on every member (uuid and osname set to NULL, type set to PMIX_DEVTYPE_UNKNOWN, and both mindist and maxdist set to UINT16_MAX).
The returned array is owned by the caller and must eventually be released with PMIx_Device_distance_free(3) <#man3-pmix-device-distance-free>, which destructs the contents of each element and frees the array storage.
RETURN VALUE¶
Returns a pointer to the newly allocated array of pmix_device_distance_t <#man5-pmix-device-distance-t> structures, or NULL if n is zero or the allocation fails.
EXAMPLES¶
Create and later release an array of device-distance structures:
pmix_device_distance_t *dist;
dist = PMIx_Device_distance_create(4);
if (NULL == dist) {
/* handle allocation failure */
}
/* ... populate and use the array ... */
PMIx_Device_distance_free(dist, 4);
See also:
Copyright¶
2014-2026, OpenPMIx Community
| November 5, 2026 |