Solved

Why does the CPU usage on my computer seem to be single-threaded during optimization?

  • 18 March 2019
  • 1 reply
  • 401 views

Userlevel 6
Badge +2

I thought OpticStudio was supposed to utilize multi-threading for a faster optimization process. Why is my optimization running as a single-threaded process? Is this a setting I could change?


icon

Best answer by Allie 24 April 2019, 23:41

View original

1 reply

Userlevel 6
Badge +2

Zemax OpticStudio is designed to exploit all the CPUs in the user's computer without any user intervention. It will automatically determine the optimum number of threads to launch for any given calculation, including during optimization, so that you can design and optimize systems as efficiently as possible.



While OpticStudio supports multithreading during optimization, this does not mean that all cores on the computer will be used at all times during the optimization process. During optimization using the damped least squares algorithm, all threads will be used when evaluating the response of the optical system to changes in each system variable. This response function is used to evaluate the gradient of the merit function in solution space, allowing OpticStudio to take the ‘next step’ in the optimization. However, an important part of determining that ‘next step’ involves the calculation of a matrix determinant, and this calculation cannot be threaded. Depending on the system complexity and the number of variables defined, this single-threaded calculation may take a non-negligible amount of time.



Oftentimes, a more important effect in system optimizations is that the optical system must be updated and the merit function must be subsequently evaluated after that ‘next step’ has been taken. While any one operand in the merit function can be calculated using multiple CPUs – if appropriate – each operand in the merit function is currently evaluated in sequential order. In other words, evaluation of the merit function cannot be done in parallel (or ‘threaded’) – we do not use one CPU to evaluate operand n while another CPU is simultaneously evaluating operand n+1. This is because there can be operand dependencies in the user’s Merit Function (i.e. OPGT, OPLT). This is often the reason why the CPU usage will intermittently go from 100% down to 1 core during optimization!


Reply