GA is not faster with parallel computing?

6 views (last 30 days)
I have a GA optimization. This runs a bit to slow so I wanted to speed it up by enabeling the parallel computing. The problem is that the optmization now runs slower,... Is it possible to make it faster?
  4 Comments
Ruben Dekeyser
Ruben Dekeyser on 25 Aug 2017
I use that option. The computer has 8 Cores, but uses only 4 workers.
Walter Roberson
Walter Roberson on 25 Aug 2017
In situations where only 4 workers are used, then typically the other 4 workers are hyperthreads rather than independent cores. Using hyperthreading typically slows down computation if you have heavy mathematical operations; hyperthreading is best for cases where half of the cores are doing I/O of some sort.
MATLAB has been known to mis-detect Intel XE cores as if they were hyperthreads.
If MATLAB is misdetecting true cores, you can edit your "local" cluster profile to tell it to use more cores.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 24 Aug 2017
Parallel computation has overhead to transfer data to the workers and to transfer results back. Because of that overhead, it is most effective when the amount of computation is relatively large compared to the amount of data transferred. If you have a short computation then the overhead can swamp any increase in performance.
If the objective function does heavy computation on large enough matrices, MATLAB will automatically call out to high performance multi-threaded libraries. In versions up to R2016a, each parallel worker can be allocated only a single core, so within each parallel worker, the calls to the high performance libraries could use only a single core, which can degrade performance. Four mldivide \ operations in parallel would, for example, typically be worse performance than doing four sequential \ operations because each of the parallel \ operations would have been allocated only one core.
Starting in R2016b it became possible to configure the parallel pools to allocate more than one core per worker. This reduces the number of parallel tasks, but can improve performance for each task. This does not happen by default, though.
Computation in parallel is not always faster than serial computation; sometimes it is only the same, and sometimes the overhead makes it much worse than serial.
  3 Comments
Walter Roberson
Walter Roberson on 25 Aug 2017
Edited: Walter Roberson on 25 Aug 2017
The R2016b release notes say,
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.

Sign in to comment.

Categories

Find more on Downloads in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!