I am trying to figure out how to parallelize the following code.
I have looked up joblib
, concurrent.futures
, and multiprocessing
modules, but cannot for the life of me figure out how they work from reading the docs and scouring SO/google.
Grid
is a class object with the appropriate methods defined and it does not matter what order the loop is processed.
def ProcessGrid(Grid):
#Parallel This Loop
for i in range(len(Grid)):
Grid[i].AdjustCostMultiplier()
Grid[i].FindAllNeighbours(Grid)
print("Processing Grid Cell: " + str(i) + " of " + str(len(Grid)),end = "\r")
#Return to serial
return Grid