I have a function on Google Colab in python that I want to run 100 times. This function uses the GPU (specifically Pytorch) on Google Colab.
What is the fastest way I can run this function 100 times? The order does not matter.
My motivation is that I am trying to run a bootstrapping experiment. So I am trying to run the same function with different random noise 100 times. This function takes a while to run each time, which is why I am trying to parallelize the computation or send it to background workers.
I have tried to use multiprocessing Pool, but this seems to be tied to CPU cores, not GPU.
I have attempted to solve the question here (How to launch 100 workers in multiprocessing?), but these responses apply to CPU.
Any suggestions would be greatly appreciated.
Thank you, in advance!