Table of Contents
qarray_create - allocate a runtime distributed array
#include
<qthread/qarray.h>
qarray *
qarray_create (const size_t count, const size_t unit_size);
qarray *
qarray_create_tight (const size_t count, const size_t unit_size);
qarray
*
qarray_create_configured (const size_t count, const size_t unit_size,
const distribution_t d, const char tight, const int seg_pages);
These
functions initialize qarray distributed array objects. All three functions
create an array containing at least count elements that are at least unit_size
bytes long each. The qarray_create() function may round the element size
up to the next-largest multiple of eight, but the qarray_create_tight()
is guaranteed not to do that, so that elements are packed tightly in the
array. The qarray_create_configured() function provides greater control
over the array implementation, allowing the distribution pattern (d), and
the length of the distributed array segments (seg_pages) to be specified.
The seg_pages argument specifies the number of memory pages in a single
segment; memory cannot be distributed in units smaller than a single page.
If seg_pages is zero, a default value is chosen.
The possible values for
d are:
- FIXED_HASH
- Distributes the memory across the available shepherds
evenly, using a basic round-robin assignment mechanism based on the address
of the initial page of each segment. Array segments cannot be relocated.
- FIXED_FIELDS
- Distributes the memory evenly across all shepherds, maintaining
long contiguous sets of segments on each shepherd. Segment locations are
defined by a simple math operation on the index, so array segments cannot
be relocated.
- ALL_LOCAL
- Assigns the entire array to the local shepherd. Array
segments cannot be relocated.
- ALL_RAND
- Assigns the entire array to a random
shepherd. Array segments cannot be relocated.
- ALL_LEAST
- Assigns the entire
array to the shepherd with the least qarray segments currently assigned
to it. Array segments cannot be relocated.
- DIST_STRIPES
- Assigns array segments
with a round-robin mechanism. Segment location is stored in the segment,
so segments can be relocated, but finding a segment requires extra memory
operations.
- DIST_FIELDS
- Assigns array segments evenly across all shepherds,
attempting to maintain long contiguous sets of segments on each shepherd.
Segment location is stored in the segment, so segments can be relocated,
but finding a segment requires extra memory operations.
- DIST_RAND
- Assigns
array segments randomly to shepherds. Segment location is stored in the
segment, so segments can be relocated, but finding a segment requires extra
memory operations.
- DIST_LEAST
- Assigns each array segment to whichever shepherd
has the fewest array segments assigned to it at creation time. Segment location
is stored in the segment, so segments can be relocated, but finding a segment
requires extra memory operations.
qarray_destroy(3)
, qarray_iter(3)
,
qarray_shepof(3)
, qarray_elem(3)
Table of Contents