Class PartitionedBroadcast<T extends CacheBlock>
java.lang.Object
org.apache.sysds.runtime.instructions.spark.data.PartitionedBroadcast<T>
- All Implemented Interfaces:
Serializable
This class is a wrapper around an array of broadcasts of partitioned matrix/frame blocks,
which is required due to 2GB limitations of Spark's broadcast handling. Without this
partitioning of
Broadcast<PartitionedBlock> into Broadcast<PartitionedBlock>[],
we got java.lang.IllegalArgumentException: Size exceeds Integer.MAX_VALUE issue.
Despite various jiras, this issue still showed up in Spark 2.1.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPartitionedBroadcast(org.apache.spark.broadcast.Broadcast<PartitionedBlock<T>>[] broadcasts, DataCharacteristics dc) -
Method Summary
Modifier and TypeMethodDescriptionstatic intcomputeBlocksPerPartition(long[] dims, int blen) static intcomputeBlocksPerPartition(long rlen, long clen, long blen) voiddestroy()This method cleanups all underlying broadcasts of a partitioned broadcast, by forward the calls to SparkExecutionContext.cleanupBroadcastVariable.getBlock(int[] ix) getBlock(int rowIndex, int colIndex) org.apache.spark.broadcast.Broadcast<PartitionedBlock<T>>[]longintintlongUtility for slice operations over partitioned matrices, where the index range can cover multiple blocks.
-
Constructor Details
-
PartitionedBroadcast
public PartitionedBroadcast() -
PartitionedBroadcast
public PartitionedBroadcast(org.apache.spark.broadcast.Broadcast<PartitionedBlock<T>>[] broadcasts, DataCharacteristics dc)
-
-
Method Details
-
getBroadcasts
-
getNumRows
public long getNumRows() -
getNumCols
public long getNumCols() -
getNumRowBlocks
public int getNumRowBlocks() -
getNumColumnBlocks
public int getNumColumnBlocks() -
getDataCharacteristics
-
computeBlocksPerPartition
public static int computeBlocksPerPartition(long rlen, long clen, long blen) -
computeBlocksPerPartition
public static int computeBlocksPerPartition(long[] dims, int blen) -
getBlock
-
getBlock
-
slice
Utility for slice operations over partitioned matrices, where the index range can cover multiple blocks. The result is always a single result matrix block. All semantics are equivalent to the core matrix block slice operations.- Parameters:
rl- row lower boundru- row upper boundcl- column lower boundcu- column upper boundblock- block object- Returns:
- block object
-
destroy
public void destroy()This method cleanups all underlying broadcasts of a partitioned broadcast, by forward the calls to SparkExecutionContext.cleanupBroadcastVariable.
-