I would like to use a multiprocessor package, for example, in this code . I tried calling the function create_new_populationand distributing the data to 8 processors, but when I do, I get a pickle error.
Typically, a function runs as follows: self.create_new_population(self.pop_size)
I am trying to distribute the work as follows:
f= self.create_new_population
pop = self.pop_size/8
self.current_generation = [pool.apply_async(f, pop) for _ in range(8)]
I get or Can't pickle local object 'exhaust.__init__.<locals>.tour_select'
PermissionError: [WinError 5] Access is denied
I carefully read this topic and also tried to get around the error using the approach from Steven Bethard to enable the etching / spilling method via copyreg:
def _pickle_method(method)
def _unpickle_method(func_name, obj, cls)
.
, if __name__ == '__main__':, , .