Use multiprocessing!
import multiprocessing
from itertools import product
results = []
def callback(return_value):
# this stores results
results.append(return_value)
if __name__=="__main__" :
pool = multiprocessing.Pool(4)
args = product(range1, range2, range)
for x, y, z in args:
pool.apply_async(f,(x,y,z),call_back=callback)
pool.close()
pool.join()
Now you can run your function while also taking advantage of the full capacity of your machine!