Python Programming for Biology: Bioinformatics and Beyond


Using the ‘ multiprocessing



Download 7,75 Mb.
Pdf ko'rish
bet435/514
Sana30.12.2021
Hajmi7,75 Mb.
#91066
1   ...   431   432   433   434   435   436   437   438   ...   514
Bog'liq
[Tim J. Stevens, Wayne Boucher] Python Programming

Using the ‘

multiprocessing

’ module

Below  we  give  a  couple  of  simple  examples  that  illustrate  how  multiprocessing  can  be

used.  The  examples  are  simple  in  the  sense  that  the  calculation  jobs  are  completely

separate and each parallel process doesn’t need to communicate much, other than to accept

input arguments and pass back the result. However, this is not an uncommon situation in

biological computing; for example, things like molecular structure calculations generate a

range (an ensemble)  of  separate  solutions  to  a  problem,  and  in  many  circumstances  jobs

can be run separately on independent input data.




For  our  examples  we  make  three  imports,  one  for  the  Process  class,  which  is  the

simplest  way  of  generating  a  parallel  job,  another  for  Queue,  which  allows  data  to  be

shared  between  jobs,  and  Pool,  which  provides  a  convenient  way  of  matching  a  fixed

number of processing cores with a variable number of sub-tasks; the pooling mechanism

collects jobs to be run and then allocates them to the processor when there is a free slot.

from multiprocessing import Process, Queue, Pool




Download 7,75 Mb.

Do'stlaringiz bilan baham:
1   ...   431   432   433   434   435   436   437   438   ...   514




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish