Legion Runtime
Public Member Functions | Protected Member Functions | List of all members
Legion::FieldAllocator Class Reference

#include <legion.h>

Inheritance diagram for Legion::FieldAllocator:
Legion::Unserializable< FieldAllocator >

Public Member Functions

 FieldAllocator (const FieldAllocator &allocator)
 
 FieldAllocator (FieldAllocator &&allocator) noexcept
 
FieldAllocatoroperator= (const FieldAllocator &allocator)
 
FieldAllocatoroperator= (FieldAllocator &&allocator) noexcept
 
bool operator< (const FieldAllocator &rhs) const
 
bool operator== (const FieldAllocator &rhs) const
 
bool exists (void) const
 
void free_field (FieldID fid, const bool unordered=false, const char *provenance=NULL)
 
FieldID allocate_local_field (size_t field_size, FieldID desired_fieldid=LEGION_AUTO_GENERATE_ID, CustomSerdezID serdez_id=0, const char *provenance=NULL)
 
void free_fields (const std::set< FieldID > &to_free, const bool unordered=false, const char *provenance=NULL)
 
void allocate_local_fields (const std::vector< size_t > &field_sizes, std::vector< FieldID > &resulting_fields, CustomSerdezID serdez_id=0, const char *provenance=NULL)
 
FieldSpace get_field_space (void) const
 
FieldID allocate_field (size_t field_size, FieldID desired_fieldid=LEGION_AUTO_GENERATE_ID, CustomSerdezID serdez_id=0, bool local_field=false, const char *provenance=NULL)
 
FieldID allocate_field (const Future &field_size, FieldID desired_fieldid=LEGION_AUTO_GENERATE_ID, CustomSerdezID serdez_id=0, bool local_field=false, const char *provenance=NULL)
 
void allocate_fields (const std::vector< size_t > &field_sizes, std::vector< FieldID > &resulting_fields, CustomSerdezID serdez_id=0, bool local_fields=false, const char *provenance=NULL)
 
void allocate_fields (const std::vector< Future > &field_sizes, std::vector< FieldID > &resulting_fields, CustomSerdezID serdez_id=0, bool local_fields=false, const char *provenance=NULL)
 
- Public Member Functions inherited from Legion::Unserializable< FieldAllocator >
size_t legion_buffer_size (void)
 
size_t legion_serialize (void *buffer)
 
size_t legion_deserialize (const void *buffer)
 

Protected Member Functions

FRIEND_ALL_RUNTIME_CLASSES FieldAllocator (Internal::FieldAllocatorImpl *impl)
 

Detailed Description

Field allocators provide objects for performing allocation on field spaces. They must be explicitly created by the runtime so that they can be linked back to the runtime. Field allocators can be passed by value to functions and stored in data structures, but they should never escape the enclosing context in which they were created.

Field space allocators operate on a single field space which is immutable. Separate field space allocators must be made to perform allocations on different field spaces.

See also
FieldSpace
Runtime

Member Function Documentation

◆ allocate_field()

FieldID Legion::FieldAllocator::allocate_field ( size_t  field_size,
FieldID  desired_fieldid = LEGION_AUTO_GENERATE_ID,
CustomSerdezID  serdez_id = 0,
bool  local_field = false,
const char *  provenance = NULL 
)

Allocate a field with a given size. Optionally specify the field ID to be assigned. Note if you use LEGION_AUTO_GENERATE_ID, then all fields for the field space should be generated this way or field names may be deduplicated as the runtime will not check against user assigned field names when generating its own.

Parameters
field_sizesize of the field to be allocated
desired_fieldidfield ID to be assigned to the field or LEGION_AUTO_GENERATE_ID to specify that the runtime should assign a fresh field ID
serdez_idoptional parameter for specifying a custom serdez object for serializing and deserializing a field when it is moved.
local_fieldwhether this is a local field or not
provenancean optional string describing the provenance information for this index space
Returns
field ID for the allocated field

◆ allocate_fields()

void Legion::FieldAllocator::allocate_fields ( const std::vector< size_t > &  field_sizes,
std::vector< FieldID > &  resulting_fields,
CustomSerdezID  serdez_id = 0,
bool  local_fields = false,
const char *  provenance = NULL 
)

Allocate a collection of fields with the specified sizes. Optionally pass in a set of field IDs to use when allocating the fields otherwise the vector should be empty or the same size as field_sizes with LEGION_AUTO_GENERATE_ID set as the value for each of the resulting_field IDs. The length of the resulting_fields vector must be less than or equal to the length of field_sizes. Upon return it will be the same size with field IDs specified for all the allocated fields

Parameters
field_sizessize in bytes of the fields to be allocated
resulting_fieldsoptional field names for allocated fields
local_fieldswhether these should be local fields or not
provenancean optional string describing the provenance information for this index space
Returns
resulting_fields vector with length equivalent to the length of field_sizes with field IDs specified

◆ allocate_local_field()

FieldID Legion::FieldAllocator::allocate_local_field ( size_t  field_size,
FieldID  desired_fieldid = LEGION_AUTO_GENERATE_ID,
CustomSerdezID  serdez_id = 0,
const char *  provenance = NULL 
)

Same as allocate field, but this field will only be available locally on the node on which it is created and not on remote nodes. It will then be implicitly destroyed once the task in which it is allocated completes.

◆ allocate_local_fields()

void Legion::FieldAllocator::allocate_local_fields ( const std::vector< size_t > &  field_sizes,
std::vector< FieldID > &  resulting_fields,
CustomSerdezID  serdez_id = 0,
const char *  provenance = NULL 
)

Same as allocate_fields but the fields that are allocated will only be available locally on the node on which this call is made and not on remote nodes. The fields will be implicitly destroyed once the task in which they were created completes.

◆ free_field()

void Legion::FieldAllocator::free_field ( FieldID  fid,
const bool  unordered = false,
const char *  provenance = NULL 
)

Deallocate the specified field from the field space.

Parameters
fidthe field ID to be deallocated
unorderedset to true if this is performed by a different thread than the one for the task (e.g a garbage collector)
provenancean optional string describing the provenance information for this index space

◆ free_fields()

void Legion::FieldAllocator::free_fields ( const std::set< FieldID > &  to_free,
const bool  unordered = false,
const char *  provenance = NULL 
)

Free a collection of field IDs

Parameters
to_freeset of field IDs to be freed
unorderedset to true if this is performed by a different thread than the one for the task (e.g a garbage collector)
provenancean optional string describing the provenance information for this index space

◆ get_field_space()

FieldSpace Legion::FieldAllocator::get_field_space ( void  ) const
Returns
field space associated with this allocator

The documentation for this class was generated from the following file: