parallel processing in MATLAB
1 次查看(过去 30 天)
显示 更早的评论
can we perform parallel processing in MATLAB...
Like i have a code that take input and gives out output.
e.g, the code take single number as input and convert it into its square. Input = 2 4 6 8 10
the code take 2 as a input and gives 4 as a output mean while the code take 4 as a input and gives 16 as a output and so on.. but in parallel that as when code take 2 in put at the same time it take 4 , 6 8 and 10 as an input to produce there squares as a output at the same time...?
2 个评论
Benjamin Avants
2014-3-14
Could you clarify what exactly you mean by "the same time"? If you mean as one function call, you can pass a vector of inputs, operate on the whole vector, and output the resulting vector. If you mean actually being computed at the same time, it is possible on multi-core processors or cluster type configurations as long as you have the parallel computing toolbox. Of course, you can only do as many computations simultaneously as you have processors(cores) available.
Newer versions of MATLAB have some inherent multi-core functionality when doing vector and matrix operations but I don't know the details.
If you mean that you want to be able to continue calling the function with new inputs before it returns from the previous call, you can create and run timers that execute your function, but that would not be a good way to do it with large functions or a large number of inputs because the timer threads would be competing with one another for processor time and memory.
回答(1 个)
Matt J
2014-3-14
编辑:Matt J
2014-3-14
MATLAB internally parallelizes matrix operations like
Output=Input.^2
where I've assumed the Input is a vector,
Input=[2 4 6 ...]
You can do more complicated parallel processing with the Parallel Computing Toolbox, if you have it.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!