rocAL_pybind.amd.rocal.pipeline.Pipeline Class Reference

rocAL_pybind.amd.rocal.pipeline.Pipeline Class Reference#

rocAL: rocAL_pybind.amd.rocal.pipeline.Pipeline Class Reference
rocAL_pybind.amd.rocal.pipeline.Pipeline Class Reference

Pipeline class internally calls RocalCreate which returns context which will have all the info set by the user. More...

Inheritance diagram for rocAL_pybind.amd.rocal.pipeline.Pipeline:

Public Member Functions

def __init__ (self, batch_size=-1, num_threads=0, device_id=0, seed=1, exec_pipelined=True, prefetch_queue_depth=2, exec_async=True, bytes_per_sample=0, rocal_cpu=False, max_streams=-1, default_cuda_stream_priority=0, tensor_layout=types.NCHW, reverse_channels=False, mean=None, std=None, tensor_dtype=types.FLOAT, output_memory_type=None, deserialized_pipeline_handle=None, enable_checkpointing=False)
 
def build (self)
 Build the pipeline using rocalVerify call.
 
def rocal_run (self)
 Run the pipeline using rocalRun call.
 
def define_graph (self)
 This function is defined by the user to construct the graph of operations for their pipeline. More...
 
def get_handle (self)
 
def copyToExternalTensor (self, array, multiplier, offset, reverse_channels, tensor_format, tensor_dtype, max_roi_height=0, max_roi_width=0)
 
def get_one_hot_encoded_labels (self, array_ptr, dest_device_type)
 
def set_outputs (self, *output_list)
 
def __enter__ (self)
 
def __exit__ (self, exception_type, exception_value, traceback)
 
def set_seed (self, seed=0)
 
def create_int_param (self, value=1)
 
def create_float_param (self, value=1)
 
def update_int_param (self, value=1, param=1)
 
def update_float_param (self, value=1, param=1)
 
def get_int_value (self, param)
 
def get_float_value (self, param)
 
def get_image_name (self, array_len)
 
def get_image_id (self, array)
 
def get_bounding_box_count (self)
 
def get_bounding_box_labels (self)
 
def get_bounding_box_cords (self)
 
def get_ascii_datas (self)
 
def get_mask_count (self, array)
 
def get_mask_coordinates (self, array_count, array)
 
def get_image_labels (self)
 
def copy_encoded_boxes_and_lables (self, bbox_array, label_array)
 
def get_encoded_boxes_and_lables (self, batch_size, num_anchors)
 
def get_img_sizes (self, array)
 
def get_roi_img_sizes (self, array)
 
def get_image_name_length (self, idx)
 
def checkpoint (self, filename=None)
 
def restore_checkpoint (self, serialized_ckpt=None, filename=None)
 
def get_remaining_images (self)
 
def rocal_release (self)
 
def rocal_reset_loaders (self)
 
def is_empty (self)
 
def timing_info (self)
 
def get_matched_indices (self)
 
def get_output_tensors (self)
 
def get_last_batch_padded_size (self)
 
def run (self)
 
def serialize (self, filename=None)
 
def deserialize (cls, serialized_pipeline=None, filename=None, **kwargs)
 

Detailed Description

Pipeline class internally calls RocalCreate which returns context which will have all the info set by the user.

Parameters
batch_size(int, optional, default = -1) Batch size of the pipeline. Negative values for this parameter are invalid - the default value may only be used with serialized pipeline (the value stored in serialized pipeline is used instead).
num_threads(int, optional, default = -1) Number of CPU threads used by the pipeline. Negative values for this parameter are invalid - the default value may only be used with serialized pipeline (the value stored in serialized pipeline is used instead).
device_id(int, optional, default = 0) Id of GPU used by the pipeline. Negative values for this parameter are invalid
seed(int, optional, default = -1) Seed used for random number generation. Leaving the default value for this parameter results in random seed.
exec_pipelined(bool, optional, default = True) Whether to execute the pipeline in a way that enables overlapping CPU and GPU computation, typically resultingin faster execution speed, but larger memory consumption.
prefetch_queue_depth(int or {"cpu_size": int, "gpu_size": int}, optional, default = 2) Depth of the executor pipeline. Deeper pipeline makes ROCAL more resistant to uneven execution time of each batch, but it also consumes more memory for internal buffers. Specifying a dict: { "cpu_size": x, "gpu_size": y } instead of an integer will cause the pipeline to use separated queues executor, with buffer queue size x for cpu stage and y for mixed and gpu stages. It is not supported when both exec_async and exec_pipelined are set to False. Executor will buffer cpu and gpu stages separatelly, and will fill the buffer queues when the first :meth:amd.rocal.pipeline.Pipeline.run is issued.
exec_async(bool, optional, default = True) Whether to execute the pipeline asynchronously. his makes :meth:amd.rocal.pipeline.Pipeline.run method run asynchronously with respect to the calling Python thread.
bytes_per_sample(int, optional, default = 0) A hint for ROCAL for how much memory to use for its tensors.
rocal_cpu(bool, optional, default = False) Whether to use CPU or GPU for the pipeline
enable_checkpointing(bool, optional, default = False) Enable pipeline checkpointing APIs.
max_streams(int, optional, default = -1) Limit the number of HIP streams used by the executor. Value of -1 does not impose a limit. This parameter is currently unused (and behavior of unrestricted number of streams is assumed).
default_cuda_stream_priority(int, optional, default = 0) HIP stream priority used by ROCAL. See cudaStreamCreateWithPriority in HIP documentation
tensor_layout(int, optional, default = 0) Tensor layout used for the augmentations
reverse_channels(int, optional, default = 0) Whether to reverse channels for the output tensors
mean(int, optional, default = 0) Mean value used for the image normalization
std(int, optional, default = 0) Standard deviation value used for the image normalization
tensor_dtype(int, optional, default = 0) Tensor datatype used for the pipeline
output_memory_type(int, optional, default = 0) Output memory type used for the output tensors
.
Args: batch_size
      rocal_cpu
      gpu_id (default 0)
      cpu_threads (default 1)
This returns a context

Member Function Documentation

◆ checkpoint()

def rocAL_pybind.amd.rocal.pipeline.Pipeline.checkpoint (   self,
  filename = None 
)
Capture and return the current pipeline checkpoint as bytes.
Optionally persist the checkpoint to ``filename`` if provided.
Requires enable_checkpointing=True and at least one successful run.

◆ define_graph()

def rocAL_pybind.amd.rocal.pipeline.Pipeline.define_graph (   self)

This function is defined by the user to construct the graph of operations for their pipeline.

It returns a list of outputs created by calling ROCAL Operators.

◆ deserialize()

def rocAL_pybind.amd.rocal.pipeline.Pipeline.deserialize (   cls,
  serialized_pipeline = None,
  filename = None,
**  kwargs 
)
Deserialize the pipeline from protobuffers and reconstruct the pipeline.

Args:
    serialized_pipeline (bytes, optional): Serialized pipeline protobuf payload.
        Exactly one of ``serialized_pipeline`` or ``filename`` must be provided.
    filename (str, optional): Path to a file containing the serialized pipeline
        protobuf payload. Exactly one of ``serialized_pipeline`` or ``filename``
        must be provided.
    **kwargs: Additional pipeline parameters used to override values stored in
        the serialized pipeline. Only keys that match attributes of
        :class:`b.RocalPipelineParams` are applied; unexpected keys are ignored
        with a warning.

Returns:
    Pipeline: A deserialized and built :class:`Pipeline` object.

◆ restore_checkpoint()

def rocAL_pybind.amd.rocal.pipeline.Pipeline.restore_checkpoint (   self,
  serialized_ckpt = None,
  filename = None 
)
Restore pipeline state from a checkpoint. Build must be called before restoring.
Provide exactly one of ``serialized_ckpt`` (bytes) or ``filename``.

◆ run()

def rocAL_pybind.amd.rocal.pipeline.Pipeline.run (   self)
It raises StopIteration if data set reached its end.
return:
:return:
A list of `rocalTensorList` objects for respective pipeline outputs.

◆ serialize()

def rocAL_pybind.amd.rocal.pipeline.Pipeline.serialize (   self,
  filename = None 
)
Serialize the pipeline and store into protobuffers

Args:
    filename (str, optional): Optional output path to write the serialized data to file
    
Returns:
    bytes: The serialized pipeline as protobuf payload

The documentation for this class was generated from the following file:
  • /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocal/checkouts/develop/rocAL_pybind/amd/rocal/pipeline.py