I have a pool of 150 processes:
import multiprocessing as mp
pool = mp.Pool(processes=150)
For each process, I need to generate 10000 random 3D points inside the bounding box (min_X, max_X, etc.. defines the bounding box). I need these points to determine if they are within a shape that is within the bounding box (Monte Carlo type algorithm). To generate the points, I have the code:
# generates intervals within the bounding box
# supposed to generate these points for each process
xPoints = [round(random.uniform(min_X, max_X), 2) for _ in range(10000)]
yPoints = [round(random.uniform(min_Y, max_Y), 2) for _ in range(10000)]
zPoints = [round(random.uniform(min_Z, max_Z), 2) for _ in range(10000)]
I assume I need to create a function that does the above code for calculating points, then call it with pool.apply similar to this:
pool = mp.Pool(processes=4)
results = [pool.apply(square, args=(x,)) for x in range(1,7)]
print(results)
I just can't seem to figure out how to do it though.