[Tutor] Multiprocessing with many input input parameters

DL Neil PyTutor at danceswithmice.info
Thu Jul 11 20:51:05 EDT 2019


Sydney,

1 There have been many projects to look at cells, division, 
multiplication, ... It is worth researching the Python eco-system in the 
expectation of saving yourself time and effort!

2 The latest releases of Python (such as you quote) offer updated 
asyncio module(s) for multiprocessing, ie be careful if you are reading 
older articles! We haven't discussed hardware. Most modern PC CPUs offer 
multiple "cores". Assuming (say) four cores, asyncio is capable of 
running up to four processes concurrently - realising attendant 
acceleration of the entirety.
(admittedly, I tend to limit my ambitions to number_of_cores - 1)



On 12/07/19 3:40 AM, Mike Barnett wrote:
> If you're passing parameters as a list, then you need a "," at the end of the items.  Otherwise if you have something like a string as the only item, the list will be the string.
> 
> list_with_one_item = ['item one',]
> 
> 
> @mike
> 
> -----Original Message-----
> From: Shall, Sydney <sydney.shall at kcl.ac.uk>
> Sent: Wednesday, July 10, 2019 11:44 AM
> To: tutor at python.org
> Subject: [Tutor] Multiprocessing with many input input parameters
> 
> I am using MAC OS X 10.14.5 on a MAC iBook I use Python 3.7.0 from Anaconda, with Spyder 3.3.3
> 
> I am a relative beginner.
> 
> My program models cell reproduction. I have written a program that models this and it works.
> 
> Now I want to model a tissue with several types of cells. I did this by simply rerunning the program with different inputs (cell characteristics). But now I want to send and receive signals between the cells in each population. This requires some sort of concurrent processing with halts at appropriate points to pass and receive signals.
> 
> I thought to use multiprocessing. I have read the documentation and reproduced the models in the docs. But I cannot figure out how to feed in the data for multiple parameters.
> 
> I have tried using Pool and it works fine, but I can only get it to accept 1 input parameter, although multiple data inputs with one parameter works nicely.
> 
> So, my questions are;
> 
>    1.  Is multiprocessing the suitable choice.
>    2.  if yes, how does one write a function with multiple input parameters.
> 
> Thank s in advance.
> 
> Sydney
> 
> Prodessor. Sydney Shall
> Department of Haematological Medicine
> King's College London
> 123 Coldharbour Lane
> London SE5 9NU
> ENGLAND
> E-Mail: sydney.shall
> (Correspondents outside the College should add @KCL.AC.UK)
> TEL: +44 (0)208 48 59 01
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
> 

-- 
Regards =dn


More information about the Tutor mailing list