crystian / ComfyUI-Crystools

A powerful set of tools for ComfyUI
MIT License
671 stars 31 forks source link

Feature request: GPU Selection. #8

Closed sborys-ai closed 7 months ago

sborys-ai commented 7 months ago

Is it possible to create an option to select a graphics processor for monitoring if there are multiple in the system?

crystian commented 7 months ago

I am collecting the data right now, but it's not showing, maybe next week implement it

crystian commented 7 months ago

I'm not sure, but can you use both cards simultaneously? @sborys-ai

q5sys commented 7 months ago

Since the Stable Swarm UI is built on top of Comfy and it support multiple GPUs, it'd be great if this extension could display all the GPUs in a system.

sborys-ai commented 7 months ago

No, both graphics cards cannot be used simultaneously. The problem is that in my system, the Nvidia Quadro P2000 is used as the primary graphics card for work, and the RTX3090 is used for generation in ComfyUI. However, your tool displays statistics for the Quadro, as it has priority. But this information is of no use to me, as you can understand)) therefore, I need the ability to choose.

crystian commented 7 months ago

yes, let me do it in the weekend

q5sys commented 7 months ago

Just so there's no confusion. What @sborys-ai says about only being able to use one GPU with Comfy-UI is correct.

However, Stable Swarm (Stability AI's new multiGPU interface ) can do multiple gpus and Stable Swarm uses Comfy UI within it.

But, if someone is just using the regular Comfy-UI from the Comfy-UI project... as I believe @sborys-ai is, they will be limited to one GPU.

IDK how your plugin is written, but having devices able to be selected by the user should address both uses cases.

crystian commented 7 months ago

yes @q5sys thanks for aclaration, I tried it but is difficult with my only 3080 hehe, I will try to do something for both scenarios

GianPieroA commented 7 months ago

Hi, I have a system with 2 GPUs and the second one is auto-selected by torch because is more powerful. To monitor the second GPU I had to change const gpu = data.gpus[0]; into const gpu = data.gpus[1]; inside monitor.js. Just a work-around until a GPU selector is implemented

crystian commented 7 months ago

nice @GianPieroA I'll work on it this weekend, but I need your support. Will I count on you? @q5sys @GianPieroA @sborys-ai

q5sys commented 7 months ago

@crystian I have a quad GPU system, I'm happy to help test. I can also take some screenshots and submit a PR to update the docs as well.

GianPieroA commented 7 months ago

@crystian of course, I am not a js programmer but I will do my best to support.

GianPieroA commented 7 months ago

@crystian before starting to code I would suggest to consider different approaches, with different difficulties:

  1. using the settings window to set the GPU number
  2. using pytorch to determine the used GPU
  3. add a up/down selector on the VRAM/GPU UI widgets to switch GPU at run-time

Just some ideas

q5sys commented 7 months ago
  1. using the settings window to set the GPU number

This does not take into account multi card setups where more that one card is in use at a time, ie. StableSwarm UI from Stability AI that uses Comfy UI.

3. add a up/down selector on the VRAM/GPU UI widgets to switch GPU at run-time

A up/dpwn selector would work for systems using a single card to generate images, but this would be a bad solution for multi GPU setups. If you're using multiple GPUs you'd want to be able to see all of them in use. You wouldn't want to 'switch' between what GPU is displayed, because you'd have to be going up and down constantly with the selector to monitor them all.

Hopefully whatever solution @crystian comes up with will cover both sitautions and not optimize for one at the expense of another. I'm a C/C++/QT dev... so I'm not much help with javascript.

crystian commented 7 months ago

I'm working on that, but first, I'll work with the hdd selector. Do you have Linux? @q5sys @GianPieroA @sborys-ai

crystian commented 7 months ago

is on dev, HDD selector, see on settings:

cd custom_nodes\ComfyUI-Crystools
git checkout -b dev origin/dev
q5sys commented 7 months ago

Do you have Linux? @q5sys

Yes I'm on Rocky 9.3

GianPieroA commented 7 months ago

I'm working on that, but first, I'll work with the hdd selector. Do you have Linux? @q5sys @GianPieroA @sborys-ai

No @crystian , I am on WIndows

crystian commented 7 months ago

release with typescript (not muiltple-gpu yet), can you test it please? @q5sys

GianPieroA commented 7 months ago

@crystian I was able to test HDD monitor on windows. It seems to me that it displays the HDD used space, not the throughput, is it correct ?

crystian commented 7 months ago

yes, only capacity (for now) @GianPieroA , but, can you see your drivers (and select it in the settings)

crystian commented 7 months ago

@q5sys do you have partitions? I'd like to see how the combo is drawing. Can you share an image of the settings, please?

GianPieroA commented 7 months ago

yes, only capacity (for now) @GianPieroA , but, can you see your drivers (and select it in the settings)

Yes I did test that too having C: and D: disk drives, thank you @crystian

gauravkumar37 commented 7 months ago

hey, thanks for the extension seems like the new commit is not working on linux. The problem is that is tries to initialize the extension with the initial value https://github.com/crystian/ComfyUI-Crystools/blob/15151b827a8541f5c130db22b7273004a41996d8/general/hardware.py#L18 and fails to start. Manually modifying it to / on linux works.

crystian commented 7 months ago

oh! thanks for your feedback I will fix now! @gauravkumar37

crystian commented 7 months ago

@gauravkumar37 can you update and check please? remember to remove Comfy.Settings.Crystools.whichHDD on localstorage before to test.

Btw, do you have partitions? I like to see how you see the combo on settings

Thanks!

crystian commented 7 months ago

@q5sys do you have partitions? I'd like to see how the combo is drawing. Can you share an image of the settings, please?

can you help me with this? thanks!

crystian commented 7 months ago

Multigpu support added, can you test it? @q5sys @GianPieroA @sborys-ai

cd custom_nodes\ComfyUI-Crystools
git checkout -b dev origin/gpu

remember to use setting to custom the monitors

gauravkumar37 commented 7 months ago

@gauravkumar37 can you update and check please? remember to remove Comfy.Settings.Crystools.whichHDD on localstorage before to test.

Btw, do you have partitions? I like to see how you see the combo on settings

Thanks!

Thanks, the fix is working now. I see all the partitions in the combo-box. Minor suggestion: you may want to filter out temporary partitions like tmpfs or snap ones which are not on real disks.

GianPieroA commented 7 months ago

There is something wrong with Settings:
Menu At the begining they appeared correctly configured (check in settings and present on the main panel). Then something happens, when checking and unchecking them: they desync and now seem to work on the contrary (the iteam appears on the main panel when its relative setting is unchecked. Perhaps a [menu] appears in settings as you can see from the image.

GianPieroA commented 7 months ago

After restarting ComfyUI i found all settings checked but no widget displayed. I then unchecked them all and now the widgets are visible but not working (they show -1) Menu1

Update: local storage seems moving accordly with choices set on settings tab. Is just the main panel UI that works inversely

crystian commented 7 months ago

perfect, I will check at night!

GianPieroA commented 7 months ago

Update 2: cleaning local storage and restarting comfyui everything seems fine (all widgets are there and settings aligned, I mean checked.) The first attempt to uncheck an item from settings make it inconsistent: che uncheck operation doesn't make the relative widget disappear and then, at the next click of the checkbox, it starts to work on the contrary

crystian commented 7 months ago

@GianPieroA can you try again please? but in this case, remove from localstorage the keys: Comfy.Settings.Crystools.switchVRAM* and Comfy.Settings.Crystools.switchGPU* .... and..

I didn't know this, they save your configuration on user/default/comfy.settings.json, please remove also the keys Crystools.*

Thanks for your helping!

crystian commented 7 months ago

we can chat here: https://github.com/crystian/ComfyUI-Crystools/discussions/20 🙏

crystian commented 7 months ago

feature added on 1.10.0 :)

q5sys commented 7 months ago

@q5sys do you have partitions? I'd like to see how the combo is drawing. Can you share an image of the settings, please?

can you help me with this? thanks!

Sorry, something came up with my family and so I was offline for a bit. I know this has been closed out, but I'll run this through when I get time this week and let you know

crystian commented 7 months ago

Perfect! No problem! Please share your feedback when you tried it!