A general question: For using matlabpool, I write the line
matlabpool open local 12;
as the first line in my code and the line:
matlabpool close;
as the last. Is this correct?
A general question: For using matlabpool, I write the line
as the first line in my code and the line:
as the last. Is this correct? |
||||
|
Seems to be fine according to the documentation. The only things you need to try are whether 12 is the best number for you, and whether it makes sense to close the matlabpool earlier (you might not gain anything from it for a postprocessing part). Furthermore it is of course always good to check whether it actually gives the speed increase that you are looking for. |
|||
|
This is correct, but I would recommend you to use |
|||
|
My answer is very late, but I'd like to suggest a couple of improvements to your code. Firstly, I would use the functional form, rather than the command-dual form:
and
as it's easier (if you later need to) to parameterize the number of workers or the cluster used. The next suggestion assumes that the instructions for opening and closing the pool are within a function. If you're just writing some quick code, this doesn't really matter, but for larger applications it's typically better to be writing reusable, modular functions with their own workspace rather than scripts. I would typically write two consecutive lines:
This creates an This pattern has two advantages:
|
|||
|