comfy-cli icon indicating copy to clipboard operation
comfy-cli copied to clipboard

Add multi gpus feature

Open nvdamien opened this issue 9 months ago • 1 comments

Related to https://github.com/Comfy-Org/comfy-cli/issues/258

Comfyui-cli uses a config file config.ini to save and check if a Comfyui server was started:

[DEFAULT]
enable_tracking = False
recent_workspace = /home/user/Documents/comfyui/ComfyUI
background = ('127.0.0.1', '8188', 1131305)

A new command line flag ("--name") was added to the "launch" and "stop" command. When "--name" is added, this is adding a new section into the config.ini.

For example:

comfy --launch --name GPU_0 -- --port 8188 --cuda-device 0
comfy --launch --name GPU_1 -- --port 8288 --cuda-device 1

Will give in the config.ini:

[DEFAULT]
enable_tracking = False
recent_workspace = /home/user/Documents/comfyui/ComfyUI

[GPU_0]
background = ('127.0.0.1', '8188', 1131305)

[GPU_1]
background = ('127.0.0.1', '8288', 1132502)

From here, we can stop a server using the same --name flag:

comfy stop --name GPU_0

Will stop the server GPU_0 and remove the session GPU_0 from the config.ini

This feature let us starts multiple servers on the same machine that has multiple GPUs.

nvdamien avatar Apr 25 '25 21:04 nvdamien

Codecov Report

Attention: Patch coverage is 38.80597% with 41 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
comfy_cli/config_manager.py 45.00% 22 Missing :warning:
comfy_cli/command/launch.py 23.07% 10 Missing :warning:
comfy_cli/cmdline.py 37.50% 5 Missing :warning:
comfy_cli/command/run.py 20.00% 4 Missing :warning:
Flag Coverage Δ
unittests 44.66% <38.80%> (-0.12%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
comfy_cli/constants.py 100.00% <100.00%> (ø)
comfy_cli/command/run.py 17.22% <20.00%> (+0.06%) :arrow_up:
comfy_cli/cmdline.py 47.47% <37.50%> (-0.38%) :arrow_down:
comfy_cli/command/launch.py 17.55% <23.07%> (+0.09%) :arrow_up:
comfy_cli/config_manager.py 52.22% <45.00%> (-2.58%) :arrow_down:
:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Apr 25 '25 22:04 codecov[bot]