Made it multi-threading: C = A * B, where A is an Eigen::ColMajor
sparsematrix and B is an Eigen::RowMajor
sparsematrix.
实现了Eigen::ColMajor
稀疏矩阵乘Eigen::RowMajor
稀疏矩阵的多线程乘法。
Here we made 2 test cases:
- A is
471538
*941014
, B is941014
*471538
, with0.00127%
nonzero values. - A is
235771
*235771
, B is235771
*235771
, with0.00296%
nonzero values.
The machine has an Intel Core-i7 6700K CPU @ 4.38GHz, with 16GiB 2400MHz DDR4 memory (single channel) on Windows 10.0.17134.407. We made the product of each case continuously for 4 times, and logged the total time consumed as following.
Method | Case | 1st | 2nd | 3rd | 4th |
Eigen's | 1 | 1141ms | 1176ms | 1162ms | 1162ms |
Ours | 1 | 345ms | 298ms | 313ms | 298ms |
Eigen's | 2 | 471ms | 479ms | 476ms | 475ms |
Ours | 2 | 140ms | 115ms | 121ms | 120ms |
This method turns out to perform a little worse for the 1st product due to memory allocation, but it becomes faster for the following. The overall speed-up ratio is 3.30 ~ 4.16 on this 4 cored machine, according to the table.