필터 지우기
필터 지우기

make two while loop work parallely

조회 수: 4 (최근 30일)
John Carlson
John Carlson 2019년 1월 17일
댓글: John Carlson 2019년 1월 20일
I want to run two while functions at the same time , for example make two cores of my computer work on loop 1 and two cores on loop 2 .
Is it possible in matlab ?

채택된 답변

Walter Roberson
Walter Roberson 2019년 1월 17일
If you have the Parallel Computing Toolbox, you can use
parpool(2)
parfevalOnAll(@maxNumCompThreads, 0, 2)
spmd
if labindex == 1
first_function
else
second_function
end
end
  댓글 수: 1
John Carlson
John Carlson 2019년 1월 20일
Thanks a lot , it worked just fine.

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

추가 답변 (1개)

nanren888
nanren888 2019년 1월 17일
Sure, run two Matlabs.
Why?
  댓글 수: 1
John Carlson
John Carlson 2019년 1월 20일
It's not possible for some problems.
For example if you are connecting with a raspberry pi you can only publish one connection through one matlab .

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by