This application discloses an optimization method, device, medium, and product for a
sparse matrix-vector multiplication
algorithm, relating to the fields of high-
performance computing and sparse computing. The method includes: setting multiple preset candidate block shapes; sequentially calculating the
score of each candidate block shape; selecting the candidate block shape with the highest
score as the optimal block shape; rearranging multiple data rows based on the number of non-zero elements in all data rows; performing block
processing on the rearranged target
sparse matrix based on the optimal block shape; allocating the computation task of the processed block-shaped target
sparse matrix to multiple thread bundles for parallel execution; for each data row: if the number of corresponding non-zero elements exceeds a preset threshold, then splitting the data row into multiple subtasks according to the preset threshold and allocating them to different thread bundles for
processing; avoiding performance bottlenecks caused by some thread bundles
processing excessive amounts of data, thereby ensuring that GPU
parallel computing resources are utilized efficiently and in a balanced manner.