Improving Python performance with multiprocessing | Python tricks
ฝัง
- เผยแพร่เมื่อ 5 ก.ย. 2024
- [www.buymeacoff...] A basic introduction into multiprocessing with Python. I first describe what multiprocessing is, and when to use it, and then I show how to use the multiprocessing.Pool() object. You can view the code here: osf.io/xnhec/
Literally the best videos. Way too underrated channel.
This channel is a hidden gem
Thank you. Cooler with the sunglasses though, damn that asynch video was so cool...
Haha, well maybe I should reintroduce the glasses then.
Sebastiaan Mathôt with the sunglasses, I am not certain if you are getting ready to teach Python, or how to invest in Bitcoin LOL
Jesus H. Christ... a fter so many forums read and videos watched ,easily the best and most clear multi processing video thank you sir.
Another fantastic tutorial! Your explanations and presentation style always make the subject matter easier to understand and enjoyable to watch. A huge thanks for the ongoing videos.
Awesome... succinct and precise... there are only a few other channels that make learning python enjoyable and easy-breezy
Fantastic...nice intro; and cool please continue making the videos like this request not to give up due to fewer views.
Great content! Thank you.
I'm glad that I found your channel. Thanks man! Very informative and useful video.
An excellent presentation of a useful topic.
You have an outstanding ability to explain concepts.
Thanks!
Another great video! Thank you :)
good , appreciate your work
Great 👍... looking forward to more python videos
Great work dude .... Keep the contents flowing every week if possible .....
Thank You Sebastiaan.
Hello,
good explanation! Go ahead.
could you pls. explain in future movies - multi-inheritance, composition and aggregation / OOP?
Thanks for your interest. I've been considering doing exactly that for a while. Object-oriented programming is a very big topic that would require a series of video lectures, and thus a lot of time. So for now it's a maybe!
@ yes, absolutely agree. These might be just a few ideas for future videos. There are a lot of channels with beginner- and middle level. But like this One - it’s just a few.
So in the instance with smaller numbers, the multiprocessing is taking longer because of the lag of sending the functions to other processors and returning the values is slower than just computing on the same processor?
very well explained, thx Sebastiaan, but when I execute the exact same code on my jupyter notebook it keeps running and it doesn't stop neither results come up , any suggestions?
mp.Pool() hangs the program ... I see multiple times start fact(50000)
Well, I tried your example in the Anaconda distribution of Jupyter, but when I execute the cell it doesn't output anything and it doesn't stop as well.
Here is my code for reference:
import multiprocessing as mp
t0 = time.time()
with mp.Pool() as pool:
result = pool.map(factorial, NUMBERS)
t1 = time.time()
print(f"Excecution took {t1-t0:.4f}")
PS: I have 16 Cores, but I've tried to limit the processes to 2.
I have the exact same issue except that the process I have set is 4
Hello,
at the moment I have the following code (I use the _thread module):
for thread_num, (continent, name, trade) in enumerate( zip(needed_continent_info, con.sheet_name_list, trade_val)):
start_new_thread(gapi.api, (continent, date, trade, name, client[thread_num], thread_num))
How I can do the same thing with the "mp" module?
Thanks for your comment. This seems like the type of question that is too complicated for a TH-cam comment section! I would post this on a site like StackOverflow, with a clear description of what exactly you're trying to do!