I am having issues with trying to use global variables in a multiprocessing pool. I know there is quite a lot of content on this already, but I am struggling to implement the answers to my case.
I have a function that I want to use with pool.map. I want the input of this function to be a few global variables and also one other parameter that changes process-to-process. That is I want something that looks like:
if __name__ == '__main__':
A = Global Variable Array
B = Global Variable Array
C = Actual Input Array For the Multiprocessing
pool = multiprocessing.Pool()
Res= pool.map(Function,Input = A,B,C)
In the above case only C varies from process-to-process. Currently my code only works if I import the global arrays from an external files within each process, which seems very wasteful.
Input = A, B, Cto mean?Pool.mapdoes not take a parameterInput, andInput = A, B, Cpasses onlyAtoInput.