Hi, I want to implement parfor in my code (which takes lot of time if i use only for loops). but, when i test a simple code to see the differences btw for and parfor, puzzlingly, parfor took more time than for. so i wonder, at what circumstances i need to implement parfor loop or does the code has to to running times longer to implement parfor function? thanks in advance Arun
These are some of the costs associated with the parallel/distributed approach: 1. Fixed cost associated with setting up the separate workers ( i.e. MATLAB sessions) 2. Communication overhead associated with data sent to the various sessions and sent back to the main session. 3. In case of distributed computing approach, workers may need to communicate with each other. To overcome these costs and realize economies of scale:) , your problem needs to have some characteristics of a "large scale" problem - combing either of these: 1. Each program takes a long time to execute (either through complex computations or through a processing large data set such as a high density image) 2. You have a large number of programs to execute Please note that this also applies to running Simulink models (which can also be though of as programs) with PARFOR.