Python 🐍 Multi-Threading

preview_player
Показать описание
Programs can run on multi-core processors, heterogeneous networks, and platforms. In this example application, we solve a series of optimization problems in parallel with a multi-threaded application. The optimization problems are initialized sequentially, computed in parallel, and returned asynchronously to Python. In Python, parallelization may be accomplished with multi-threading. The example shows how to create and run a program with 10 threads that each print a message and then solve an optimization problem many times to create a 3D contour plot.

Рекомендации по теме
Комментарии
Автор

Any suggestions how to use multithreading (multiprocessing?) to update a matplotlib figure?

I have a thread/process that saves data from the serial port (arriving randomly every 10ms-10sec), but how should that data be passed to matplotlib/pyqtgraph? Queue? At the moment its updating the matplotlib plot directly, but the gui is very unresponsive between updates!

Should I use another process/thread that just monitors the queue periodically and that process calls that matplotlib? Or is this typically done via FuncAnimation/pyplot.ion(), it it's own thread, and that monitors the queue periodically?

bennguyen
Автор

I am new user of Gekko. I ran the example of single thread which takes 1.5 seconds to execute on my machine of Processor 2, 6 Ghz, 6 Core Intel Core i7. However, I am unable to run the code of Multi thread, with both 8 threads and 4 threads option.

afrazmehmood
Автор

Thanks for this video.
I began using Gekko last week for simulation.
I had to use it locally on my laptop( remote=false) .
Could I use similar multi thread coding with gekko in simulation mode to run 8 simulations with different parameter faster than sequentially?

pierreruwet
Автор

Thank for the content, could you be able to clusterization data sciences maths ( with respect to K-mean, Hierachical, Density).

hubstrangers