Multithread Matrix Operation Method for Load Balancing
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional matrix operation techniques using multiple threads often result in increased execution time due to inefficiencies, particularly when the dimension of a partitioned submatrix cannot be evenly divided by a block size, leading to bottlenecks and prolonged processing times.
Innovation Solution
The proposed solution involves partitioning a matrix into multiple submatrices, where one set of submatrices has dimensions that are multiples of the block size in either the row or column direction, and another set that includes the remaining dimensions, allowing these submatrices to be assigned to multiple threads for parallel processing, thereby equalizing the processing load and reducing overall execution time.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If a matrix is partitioned into multiple submatrices with nearly the same dimension for parallel processing by multiple threads, then productivity is improved, but the time required for execution increases when one thread has lower execution efficiency due to non-multiple dimensions
Solution Approach 1:
The matrix is segmented into two types of submatrices: first submatrices with dimensions that are multiples of the block size (for efficient parallel processing) and second submatrices with remaining dimensions. This segmentation allows threads processing first submatrices to operate at full efficiency while threads processing second submatrices handle the residual elements, preventing any single thread from becoming a bottleneck due to non-multiple dimensions.
Solution Approach 2:
Different regions of the matrix are assigned different partitioning strategies. The first submatrices are specifically designed with dimensions that are multiples of the block size to optimize for parallel thread execution efficiency, while the second submatrices accommodate the remaining elements. This local optimization ensures that the majority of processing occurs in efficiently-sized blocks.
2Manufacturing precision
If matrix dimensions are evenly divided by block size for efficient register utilization, then manufacturing precision is improved, but adaptability decreases when handling matrices with arbitrary dimensions
Solution Approach 1:
The matrix partitioning is segmented into first submatrices with dimensions that are multiples of the block size and second submatrices with remaining dimensions. This allows the system to maintain precise dimension alignment for the primary processing blocks while accommodating arbitrary matrix sizes through the residual second submatrices, thus preserving both precision and adaptability.
Solution Approach 2:
The partitioning strategy dynamically adjusts based on the input matrix dimensions. When the matrix dimensions are already multiples of the block size, only first submatrices are created. When dimensions are not multiples, second submatrices are created to handle the remainder. This parameter-based adaptation allows the system to optimize for precision when possible while maintaining versatility for arbitrary dimensions.
Data Source
AI summary
An information processing apparatus includes a memory; and a processor. The processor is configured to execute partitioning a predetermined matrix whose values of elements are to be generated by a matrix operation, into a predetermined number of first submatrices whose dimension in at least one of a row direction and a column direction is a multiple of a block size corresponding to a number of registers used for the matrix operation, and into the predetermined number of second submatrices that are different from the predetermined number of the first submatrices; and assigning a matrix operation to generate values of elements of each of the predetermined number of the first submatrices, and a matrix operation to generate values of elements of each of the predetermined number of the second submatrices, to each of the predetermined number of threads.


