I am trying to utilize multi processing tool with numpy arrays. I want to run func1()
and func2()
simultaneously and then use np.concatenate()
and place Solution_1
and Solution_2
together. How will I be able to do such a thing?
Modules:
import multiprocessing
import numpy as np
Code:
Numbers = np.array([1,2,3,4,5,6,7,8,9,10,11,12])
def func1():
Solution_1 = Numbers + 10
return Solution_1
def func2():
Solution_2 = Numbers * 10
return Solution_2
#setting up the multi processing vars
p1 = multiprocessing.Process(target=func1)
p2 = multiprocessing.Process(target=func2)
#running the multi processes
if __name__ == "__main__":
p1.start()
p2.start()