I have three functions in the python that each one puts an image (image path)
as input and makes a simple image processing and creates a new image (image
path) as output.
in the example below, one function depends on the other, ie: the function of
alg2 takes as input the image that generates the function of alg and the
function of alg3 assign as input the image that generates the function of alg2
which depends on the function of alg1.
(I hope you do not mind basically)
because of their relatively high execution time (image processing is that) I
would like to ask if I can to parallelize them using python multiprocessing. I
have read about multiprocessing map and pool but I was pretty confused .
whenever I summarize I have three interdependent functions and I would like to
run them together if done. I would also like to know how I would perform these
three functions in a contemporary way if they were not interdependent, ie each
was autonomous.
def alg1(input_path_image,output_path_image):
start = timeit.default_timer()
###processing###)
stop = timeit.default_timer()
print stop - start
return output_path_image
def alg1(output_path_image,output_path_image1):
start = timeit.default_timer()
###processing###
stop = timeit.default_timer()
print stop - start
return output_path_image1
def alg3(output_path_image1,output_path_image2):
start = timeit.default_timer()
###processing###
stop = timeit.default_timer()
print stop - start
return output_path_image2
if __name__ == '__main__':
alg1(output_path_image,output_path_image)
alg2(output_path_image1,output_path_image1)
alg3(output_path_image2,output_path_image2)
--
https://mail.python.org/mailman/listinfo/python-list