0

I am using pool.starmap for parallel running of my function as follows.

def func_parallel(arg_1):

  ## Compute two ouputs and return those two outputs
  ## output_1=function_1(arg1)
  ## output_2=function_2(arg1)
return output_1, output_2




file_name_1_list=[file_1, file_2]

pool = mp.Pool(2)

result_1, result_2= pool.starmap(func_parallel, [(file) for file in file_name_1_list])
pool.close()

What I want with the above code:

As I have two files in file_name_1_list=[file_1, file_2], and for each file, I should be getting two outputs.

I want that output_1 should go into result_1 and output_2 should go into result_2 for each of the files given as an argument to my parallel function via starmap

The result_1 and result_2 are lists.

How can I change the above code to achieve my desired results (output_1 should go into result_1 and output_2 should go into result_2 for each of the files given as an argument to my parallel function via starmap)

Stupid420
  • 1,347
  • 3
  • 19
  • 44

0 Answers0