Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying GPU ID #55

Open
MohamadHarastani opened this issue Oct 8, 2023 · 7 comments
Open

Specifying GPU ID #55

MohamadHarastani opened this issue Oct 8, 2023 · 7 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@MohamadHarastani
Copy link

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
Copy link
Collaborator

jmp1985 commented Oct 9, 2023

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
Copy link
Author

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 #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
Copy link
Collaborator

jmp1985 commented Oct 9, 2023

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
Copy link
Author

Hi James

Sure! I'll email you with details.

Cheers
Mohamad

@jmp1985
Copy link
Collaborator

jmp1985 commented Oct 20, 2023

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
Copy link
Collaborator

jmp1985 commented Oct 20, 2023

I have also updated the pypi version

@MohamadHarastani
Copy link
Author

Hi James,

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

Cheers and till soon :-)
Mohamad

@jmp1985 jmp1985 self-assigned this Nov 15, 2023
@jmp1985 jmp1985 added the enhancement New feature or request label Nov 15, 2023
@jmp1985 jmp1985 added this to the v0.7 milestone Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

2 participants