Multithreaded calls to the objective function of scipy.optimize.leastsq

后端 未结 5 394
孤街浪徒
孤街浪徒 2020-12-29 00:47

I\'m using scipy.optimize.leastsq in conjunction with a simulator. leastsq calls a user-defined objective function and passes an input vector to it

5条回答
  •  心在旅途
    2020-12-29 01:01

    NumPy/SciPy's functions are usually optimized for multithreading. Did you look at your CPU utilization to confirm that only one core is being used while the simulation is being ran? Otherwise you have nothing to gain from running multiple instances.

    If it is, in fact, single threaded, then your best option is to employ the multiprocessing module. It runs several instances of the Python interpreter so you can make several simultaneous calls to SciPy.

提交回复
热议问题