rosalindfranklininstitute / parakeet

Phantom generator
GNU General Public License v3.0
18 stars 5 forks source link

Specifying GPU ID #55

Open MohamadHarastani opened 11 months ago

MohamadHarastani commented 11 months ago

Hello James

I have two GPUs on a machine. When I launch two simulations at the same time, the two go to the same GPU (the one with ID 0). Can we have an option to specify the GPU ID in the config file?

Cheers Mohamad

jmp1985 commented 11 months ago

Hi Mohamad

This sounds like a good suggestion. I guess there are potentially two ways you may want to use this:

  1. Using a single GPU for a simulation run and specifying the GPU ID. Then simulating each image sequentially using that GPU.
  2. Using both GPUs and using two processes to simulate two images in parallel, one on each GPU.

I will try and implement both these use cases.

Are there any other use cases you think would be useful?

Best wishes James

MohamadHarastani commented 11 months ago

Hi James

Thanks a lot for the fast response! I think the second option should be the default. If we specify a list of GPU IDs (or maybe we can specify ALL as an option) in the config file, the first option will be automatically a subset of the second option. There is an issue that I reported in the past related to the pixel size https://github.com/rosalindfranklininstitute/parakeet/issues/47. Somehow, I need to simulate all my data with a pixel size of 1 A/pix, then to bin it to the size I really need (like 2 or 3 A). A single big tilt series starts to take too much disk space (exit wave + optics + detector). Otherwise, Parakeet has been behaving quite well :-)

Cheers Mohamad

jmp1985 commented 11 months ago

Hi Mohamad

Ok, sounds like a plan! I will add this functionality this week and let you know when it's done.

Perhaps we should have a video catchup at some point to discuss any other features you need?

Best wishes James

MohamadHarastani commented 11 months ago

Hi James

Sure! I'll email you with details.

Cheers Mohamad

jmp1985 commented 10 months ago

Hi @MohamadHarastani

Just to let you know that I have added the ability to set the GPU ID in #56 . I wanted to also allow using multiple processes with multiple GPUs but I ran into a problem because HDF5 files have issues with more than one process so I will need to refactor some bits. So currently that is still not possible but I will try to do that soon.

To set the GPU id you can do the following:

parakeet.simulate.exit_wave -c config.yaml --device=gpu --gpu_id=1

Or in the config file

multiprocessing: device: gpu gpu_id: 1

jmp1985 commented 10 months ago

I have also updated the pypi version

MohamadHarastani commented 10 months ago

Hi James,

Thanks a lot for the update! This helps a lot.

Cheers and till soon :-) Mohamad