how to parallelize separate matrix-matrix multiplications?

There are three matrix-matrix multiplications: C1=A1*B1, C2=A2*B2, C3=A3*B3.
If I wrote the code like above, the three matrix-matrix multiplications will be calculated in a sequential way. Is there an easy way to parallelize the three matrix-matrix multiplications (apart from using parfor)?
Apology if this question has been raised&answered before. I didn't find such a question after some quick search.

 採用された回答

Brendan Hamm
Brendan Hamm 2018 年 1 月 25 日
編集済み: Brendan Hamm 2018 年 1 月 25 日

0 投票

Unless you are working on a cluster, I would not expect to see any speed up from parallelizing such operations. The reason for this is that a matrix multiplication is multi-threaded, meaning that each of these computations is already utilizing multiple cores on your machine.
If you are working on a cluster, you can assign each of these variables in an SPMD block and perform the computation on each machine separately.

3 件のコメント

Jan
Jan 2018 年 1 月 25 日
For small matrices only one thread is used. If you have to multiply many of them, a parfor can be useful.
Brendan Hamm
Brendan Hamm 2018 年 1 月 25 日
This is a good point and useful for others who might happen upon this question, as according to Yang, there may not be similar posts. I was considering his question alone, but this is a better generalization of the concept.
Also, I edited the work hyper-threaded to multi-threaded, so as not to be hardware specific.
Yang
Yang 2018 年 1 月 26 日
Thanks a lot Brendan and Jan!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeParallel for-Loops (parfor) についてさらに検索

質問済み:

2018 年 1 月 25 日

コメント済み:

2018 年 1 月 26 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by