MATLAB中的并行矩阵乘法 [英] Parallel Matrix Multiplication in MATLAB

查看:375
本文介绍了MATLAB中的并行矩阵乘法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Matlab中是否有相对容易实现或透明的方式将两个大型矩阵相乘?

理想情况下,我最多要用几行代码来执行这种并行乘法,也许像这样:

    C_1 = A*B        % normal
    C_2 = pmult(A,B) % parallel
    % C_1 and C_2 have the same entries

如果有一种方法可以轻松地进行这种并列乘法,请有人指出我的代码吗?如果不是,那么有谁对在Matlab中实现并行矩阵乘法算法的最佳方法有什么想法?

在此先感谢令人敬畏的Stackoverflow社区.

编辑- 我认为,我遇到的部分问题是稀疏矩阵的矩阵乘法不会自动并行化;新问题:Matlab可以并行执行稀疏矩阵乘法吗? (CPU并行化,因为我没有启用CUDA的显卡)

解决方案

Matlab可能已经通过其隐式多线程支持来做到这一点.请参阅 http://www.mathworks.com /support/solutions/zh-CN/data/1-4PG4AN/?solution = 1-4PG4AN ;运营商. Matlab已经为您完成了微不足道的可并行化操作.只需在多核计算机上运行它即可.

Is there a relatively easy to implement or transparent way to multiply two large matrices in Matlab in parallel?

Ideally, I would like to perform this parallel multiplication with at most a few lines of code, perhaps something like:

    C_1 = A*B        % normal
    C_2 = pmult(A,B) % parallel
    % C_1 and C_2 have the same entries

If there is a way to easily do this paralell multiplication, can someone please point me to the code? If not, does anyone have any ideas on what they feel is the best way to implement a parallel matrix multiplication algorithm in Matlab?

Thanks in advance, awesome Stackoverflow community.

EDIT -- I believe that part of the issue I was running into is that matrix multiplication for sparse matrices is not automatically parallelized; it is automatically parallelized for dense matrices. New question: can Matlab do sparse matrix multiplication in parallel? (CPU parallelization as I don't have CUDA enabled graphics cards)

解决方案

Matlab probably already does this via its implicit multithreading support. See http://www.mathworks.com/support/solutions/en/data/1-4PG4AN/?solution=1-4PG4AN; the "*" operator. The trivially parallelizable operations are already done for you by Matlab; just run it on a multicore machine.

这篇关于MATLAB中的并行矩阵乘法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆