I'm familiar with matlabpool
, and parfor
usage, but I still need to speedup the computation.
I have a more powerful computer in my 1GB network. Both computers have R2010b, and have the same code and paths.
What is the simplest way to use both computers for parallel computation?
Example of the code I use today:
--- main.m---
matlabpool('open', 3);
% ...
x = randn(1e5,1);
y = nan(size(x));
parfor k = 1 : length(x)
y(k) = myfunc(x(k));
end
--- myfunc.m---
function y = myfunc(x)
y = x; % some computation
return
Depending on your preferences, MATLAB can start a parallel pool automatically. To enable this feature, select Parallel > Parallel Preferences in the Environment group on the Home tab, and then select Automatically create a parallel pool. Set your solver to use parallel processing.
Any system that has more than one CPU can perform parallel processing, as well as multi-core processors which are commonly found on computers today.
Only certain functions are optimized to take advantage of multiple core processor. More generally matlab remains a single threaded application and you have to use parallel computing toolbox to take full advantage of multi core processors.
Massively parallel computing A massively parallel processor (MPP) is a single computer with many networked processors. MPPs have many of the same characteristics as clusters, but MPPs have specialized interconnect networks (whereas clusters use commodity hardware for networking).
For real cluster computing, you'll need the distributed computing toolbox, as you can read on the parallel computing info page:
Without changing the code, you can run the same application on a computer cluster or a grid computing service (using MATLAB Distributed Computing Server™). You can run parallel applications interactively or in batch.
But installing (=buying) a toolbox just for adding one computer to the worker pool might be a bit too expensive. Luckily there are also alternatives: http://www.mathworks.com/matlabcentral/fileexchange/13775
I personally haven't used this, but think it's definitely worth a look.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With