Campbell-Muscle-Lab / PyMyoVent

PyMyoVent is computer code that simulates an idealized ventricle pumping blood around a single circulation.
http://Campbell-Muscle-Lab.github.io/PyMyoVent/index.html
BSD 3-Clause "New" or "Revised" License
3 stars 4 forks source link

Multi threading #16

Closed HosseinSharifii closed 3 years ago

HosseinSharifii commented 3 years ago

Multi threading needs to be more structured by Hossein.

kenatcampbellmusclelab commented 3 years ago

@HosseinGit Ken will do this at some stage

kenatcampbellmusclelab commented 3 years ago

Ken has implemented multithreading in PyMyoVent.py but it seems to slow simulations down, possibly due to writing to disk?

Currently deactivated

HosseinSharifii commented 3 years ago

I am not an expert , but It depends on how you implemented it. There are different ways out there, and I have seen that multithreading is not quite similar to multiprocessing! Multithreading mainly is used for I/O bound application like websites stuff that does not need dealing much with CPU. However, multiprocessing uses multiple memory spaces and CPU cores, which I believe is what we need in PyMyoVent. Here is an article that explains the difference: [https://blog.usejournal.com/multithreading-vs-multiprocessing-in-python-c7dc88b50b5b] I don't know how Ken has implemented this since it is not pushed back into the repository. But there is a commit in HS_growth branch that has done multiprocessing. It was tested by Hossein and seemed it was working.

kenatcampbellmusclelab commented 3 years ago

Thanks @HosseinGit - very helpful.