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

Multi-GPU allocation #13

Open
jdumont0201 opened this issue Oct 20, 2021 · 0 comments
Open

Multi-GPU allocation #13

jdumont0201 opened this issue Oct 20, 2021 · 0 comments

Comments

@jdumont0201
Copy link

jdumont0201 commented Oct 20, 2021

Hi,

I'm trying to understand device allocation here. I have different GPUs capacities, and the program stops with OOM during backward() even when free space is available.

In the code, I see two critical parts for GPU alloc:

  1. In class StyleTransfer, you create a device plan to spead the load of the 27ish layers of VGG over GPUs.
 if len(self.devices) == 1:
            device_plan = {0: self.devices[0]}
        elif len(self.devices) == 2:
            device_plan = {0: self.devices[0], 5: self.devices[1]}

meaning you send 5 first layers to GPU0 and all other to GPU1.

  1. In the stylize main loop, you actually send all images and styles to GPU0:
self.image = self.image.to(self.devices[0])
content = content.to(self.devices[0]) 

so I'm not sure whether the load is spread at all during the backward descent.

How would you see a version where the load is spread evenly depending of each capacity?

  • Would you send everything to GPU0 until almost loaded, and then send the remaining data to GPU1
  • Or would you keep the ratio of data to each GPU well-balanced during the whole process?

Regards,
J

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant