pathos

PyTesseract call working very slow when used along with multiprocessing

不想你离开。 提交于 2019-12-01 11:50:04
I've a function that takes in a list of images and produces the output, in a list, after applying OCR to the image. I have an another function that controls the input to this function, by using multiprocessing. So, when I have a single list (i.e. no multiprocessing), each image of the list took ~ 1s, but when I increased the lists that had to be processed parallely to 4, each image took an astounding 13s. To understand where the problem really is, I tried to create a minimal working example of the problem. Here I have two functions eat25 and eat100 which open an image name and feed it to the

Pickling issue with python pathos

[亡魂溺海] 提交于 2019-12-01 02:04:09
import pathos.multiprocessing as mp class Model_Output_File(): """ Class to read Model Output files """ def __init__(self, ftype = ''): """ Constructor """ # Create a sqlite database in the analysis directory self.db_name = 'sqlite:///' + constants.anly_dir + os.sep + ftype + '_' + '.db' self.engine = create_engine(self.db_name) self.ftype = ftype def parse_DGN(self, fl): df = pandas.read_csv(...) df.to_sql(self.db_name, self.engine, if_exists='append') def collect_epic_output(self, fls): pool = mp.ProcessingPool(4) if(self.ftype == 'DGN'): pool.map(self.parse_DGN, fls) else: logging.info(

Python: (Pathos) Multiprocessing vs. class methods

让人想犯罪 __ 提交于 2019-11-30 23:50:01
I am trying to parallelize a code using class methods via multiprocessing. The basic structure is the following: # from multiprocessing import Pool from pathos.multiprocessing import ProcessingPool as Pool class myclass(object): def __init__(self): #some code def mymethod(self): #more code return another_instance_of_myclass def myfunc(myinstance,args): #some code test=myinstance.mymethod() #more code return myresult #not an instance,just a number p=Pool() result = p.map(myfunc,listwithdata) After this had failed with the normal multiprocessing, I became aware of the issues with Pickle and

Pickling issue with python pathos

半腔热情 提交于 2019-11-30 20:40:38
问题 import pathos.multiprocessing as mp class Model_Output_File(): """ Class to read Model Output files """ def __init__(self, ftype = ''): """ Constructor """ # Create a sqlite database in the analysis directory self.db_name = 'sqlite:///' + constants.anly_dir + os.sep + ftype + '_' + '.db' self.engine = create_engine(self.db_name) self.ftype = ftype def parse_DGN(self, fl): df = pandas.read_csv(...) df.to_sql(self.db_name, self.engine, if_exists='append') def collect_epic_output(self, fls):

Python: (Pathos) Multiprocessing vs. class methods

廉价感情. 提交于 2019-11-30 18:45:20
问题 I am trying to parallelize a code using class methods via multiprocessing. The basic structure is the following: # from multiprocessing import Pool from pathos.multiprocessing import ProcessingPool as Pool class myclass(object): def __init__(self): #some code def mymethod(self): #more code return another_instance_of_myclass def myfunc(myinstance,args): #some code test=myinstance.mymethod() #more code return myresult #not an instance,just a number p=Pool() result = p.map(myfunc,listwithdata)

How to run nested, hierarchical pathos multiprocessing maps?

我只是一个虾纸丫 提交于 2019-11-28 09:52:22
问题 Having build a significant part of my code on dill serialization/pickling, I'm also trying to use pathos multiprocessing to parallelize my calculations. Pathos it is a natural extension of dill. When trying to run nested from pathos.multiprocessing import ProcessingPool ProcessingPool().map(fn, args) inside an other ProcessingPool().map , then I receive: AssertionError: daemonic processes are not allowed to have children E.g.: from pathos.multiprocessing import ProcessingPool def triple(x):

Python multiprocessing with pathos

廉价感情. 提交于 2019-11-27 20:28:37
问题 I am trying to use Python's pathos to designate computations into separate processes in order to accelerate it with multicore processor. My code is organized like: class: def foo(self,name): ... setattr(self,name,something) ... def boo(self): for name in list: self.foo(name) As I had pickling problems with multiprocessing.Pool, I decided to try pathos. I tried, as suggested in previous topics: import pathos.multiprocessing but it resulted in error: No module multiprocessing - which I can't