MATLAB: Parallel pool in batch processing

parallel computing

I had a question regarding batch processing and parallel pool. Is it a requirement to have a parfor or spmd command in the code to call the parallel pool if using batch processing with 60 cores to reduce the execution time of the code? Can batch processing speed up the computation without calling the parfor or spmd commands i.e just by increasing the number of cores utilized

Best Answer

Until R2016b, all workers received a single thread. The relevant R2016b release note is:
"Multithreaded Workers: Use multiple computational threads on your MATLAB workers
MATLAB workers used to run in single-threaded mode. Now you can control the number of computational threads so that workers can run in multithreaded mode and use all the cores on your cluster. This enables you to increase the number of computational threads, NumThreads, on each worker, without increasing the number of workers, NumWorkers. If you have more cores available, increase NumThreads to take full advantage of the built-in parallelism provided by the multithreaded nature of many of the underlying MATLAB libraries. For more information, see Create and Modify Cluster Profiles."
The documentation for batch shows examples of creating a batch without opening a parpool, and an example of requesting a pool. No explicit "parpool" statement is used.
If you are running on a cluster, you might need to parcluster() and batch() against that cluster.