parallel processing in MATLAB

조회 수: 4 (최근 30일)
Alina
Alina 2014년 3월 14일
댓글: Alina 2014년 3월 14일
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
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.
Alina
Alina 2014년 3월 14일
yes i want to continue calling the function with new inputs before it returns from the previous call, or want to get outputs at the same instant

댓글을 달려면 로그인하십시오.

답변 (1개)

Matt J
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.

카테고리

Help CenterFile Exchange에서 Parallel Computing에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by