Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[![Watch the video](https://i3.ytimg.com/vi/JovhfHhxqdM/hqdefault.jpg)](https://www.youtube.com/watch?v=JovhfHhxqdM)

Run the latest ComfyUI. First start installs dependencies (takes a few minutes), then when you see this in the logs, ComfyUI is ready to be used: `[ComfyUI-Manager] All startup tasks have been completed.`
Run the latest ComfyUI. First start installs dependencies (takes a few minutes), then when you see this in the logs, ComfyUI is ready to be used: `[ComfyUI-Manager] All startup tasks have been completed.` If multiple GPUs are assigned to a pod, it will create an instance of ComfyUI per each GPU.

## Access

- `8188`: ComfyUI web UI
- `8188`: ComfyUI web UI (for a singular GPU)
- `8188+n`: ComfyUI web UI (for multiple GPUs, starts with `8188` for the first GPU, increments upwards per each GPU)
- `8080`: FileBrowser (admin / adminadmin12)
- `8888`: JupyterLab (token via `JUPYTER_PASSWORD`, root at `/workspace`)
- `22`: SSH (set `PUBLIC_KEY` or check logs for generated root password)
Expand All @@ -29,3 +30,4 @@ Edit `/workspace/runpod-slim/comfyui_args.txt` (one arg per line):
- `/workspace/runpod-slim/ComfyUI`: ComfyUI install
- `/workspace/runpod-slim/comfyui_args.txt`: ComfyUI args
- `/workspace/runpod-slim/filebrowser.db`: FileBrowser DB

6 changes: 4 additions & 2 deletions README_5090.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[![Watch the video](https://i3.ytimg.com/vi/JovhfHhxqdM/hqdefault.jpg)](https://www.youtube.com/watch?v=JovhfHhxqdM)

Run the latest ComfyUI. First start installs dependencies (takes a few minutes), then when you see this in the logs, ComfyUI is ready to be used: `[ComfyUI-Manager] All startup tasks have been completed.`
Run the latest ComfyUI. First start installs dependencies (takes a few minutes), then when you see this in the logs, ComfyUI is ready to be used: `[ComfyUI-Manager] All startup tasks have been completed.` If multiple GPUs are assigned to a pod, it will create an instance of ComfyUI per each GPU.

## Access

- `8188`: ComfyUI web UI
- `8188`: ComfyUI web UI (for a singular GPU)
- `8188+n`: ComfyUI web UI (for multiple GPUs, starts with `8188` for the first GPU, increments upwards per each GPU)
- `8080`: FileBrowser (admin / adminadmin12)
- `8888`: JupyterLab (token via `JUPYTER_PASSWORD`, root at `/workspace`)
- `22`: SSH (set `PUBLIC_KEY` or check logs for generated root password)
Expand All @@ -29,3 +30,4 @@ Edit `/workspace/runpod-slim/comfyui_args.txt` (one arg per line):
- `/workspace/runpod-slim/ComfyUI`: ComfyUI install
- `/workspace/runpod-slim/comfyui_args.txt`: ComfyUI args
- `/workspace/runpod-slim/filebrowser.db`: FileBrowser DB

41 changes: 28 additions & 13 deletions start.5090.sh
Original file line number Diff line number Diff line change
Expand Up @@ -249,24 +249,39 @@ else
done
fi

# Start ComfyUI with custom arguments if provided
# Start ComfyUI instances per detected GPU with custom arguments if provided
cd $COMFYUI_DIR
FIXED_ARGS="--listen 0.0.0.0 --port 8188"
FIXED_ARGS="--listen 0.0.0.0"
CUSTOM_ARGS=""
if [ -s "$ARGS_FILE" ]; then
# File exists and is not empty, combine fixed args with custom args
CUSTOM_ARGS=$(grep -v '^#' "$ARGS_FILE" | tr '\n' ' ')
if [ ! -z "$CUSTOM_ARGS" ]; then
echo "Starting ComfyUI with additional arguments: $CUSTOM_ARGS"
nohup python main.py $FIXED_ARGS $CUSTOM_ARGS &> /workspace/runpod-slim/comfyui.log &
else
echo "Starting ComfyUI with default arguments"
nohup python main.py $FIXED_ARGS &> /workspace/runpod-slim/comfyui.log &
echo "Additional ComfyUI arguments: $CUSTOM_ARGS"
fi
else
# File is empty, use only fixed args
echo "Starting ComfyUI with default arguments"
nohup python main.py $FIXED_ARGS &> /workspace/runpod-slim/comfyui.log &
fi

# Tail the log file
tail -f /workspace/runpod-slim/comfyui.log
# Determine GPU count (default to 1 if detection fails)
GPU_COUNT=$(nvidia-smi -L 2>/dev/null | wc -l)
if [ -z "$GPU_COUNT" ] || [ "$GPU_COUNT" -le 0 ]; then
GPU_COUNT=1
fi

echo "Detected $GPU_COUNT GPU(s); starting one ComfyUI instance per GPU"

LOG_FILES=()
for (( gpu=0; gpu<GPU_COUNT; gpu++ )); do
port=$((8188 + gpu))
log_file="/workspace/runpod-slim/comfyui_gpu${gpu}.log"
LOG_FILES+=("$log_file")

echo "Starting ComfyUI on GPU ${gpu} with --port ${port}"
if [ -n "$CUSTOM_ARGS" ]; then
nohup python main.py $FIXED_ARGS --port "$port" --cuda-device "$gpu" $CUSTOM_ARGS &> "$log_file" &
else
nohup python main.py $FIXED_ARGS --port "$port" --cuda-device "$gpu" &> "$log_file" &
fi
done

# Tail log files from all instances
tail -f "${LOG_FILES[@]}"
41 changes: 28 additions & 13 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -249,24 +249,39 @@ else
done
fi

# Start ComfyUI with custom arguments if provided
# Start ComfyUI instances per detected GPU with custom arguments if provided
cd $COMFYUI_DIR
FIXED_ARGS="--listen 0.0.0.0 --port 8188"
FIXED_ARGS="--listen 0.0.0.0"
CUSTOM_ARGS=""
if [ -s "$ARGS_FILE" ]; then
# File exists and is not empty, combine fixed args with custom args
CUSTOM_ARGS=$(grep -v '^#' "$ARGS_FILE" | tr '\n' ' ')
if [ ! -z "$CUSTOM_ARGS" ]; then
echo "Starting ComfyUI with additional arguments: $CUSTOM_ARGS"
nohup python main.py $FIXED_ARGS $CUSTOM_ARGS &> /workspace/runpod-slim/comfyui.log &
else
echo "Starting ComfyUI with default arguments"
nohup python main.py $FIXED_ARGS &> /workspace/runpod-slim/comfyui.log &
echo "Additional ComfyUI arguments: $CUSTOM_ARGS"
fi
else
# File is empty, use only fixed args
echo "Starting ComfyUI with default arguments"
nohup python main.py $FIXED_ARGS &> /workspace/runpod-slim/comfyui.log &
fi

# Tail the log file
tail -f /workspace/runpod-slim/comfyui.log
# Determine GPU count (default to 1 if detection fails)
GPU_COUNT=$(nvidia-smi -L 2>/dev/null | wc -l)
if [ -z "$GPU_COUNT" ] || [ "$GPU_COUNT" -le 0 ]; then
GPU_COUNT=1
fi

echo "Detected $GPU_COUNT GPU(s); starting one ComfyUI instance per GPU"

LOG_FILES=()
for (( gpu=0; gpu<GPU_COUNT; gpu++ )); do
port=$((8188 + gpu))
log_file="/workspace/runpod-slim/comfyui_gpu${gpu}.log"
LOG_FILES+=("$log_file")

echo "Starting ComfyUI on GPU ${gpu} with --port ${port}"
if [ -n "$CUSTOM_ARGS" ]; then
nohup python main.py $FIXED_ARGS --port "$port" --cuda-device "$gpu" $CUSTOM_ARGS &> "$log_file" &
else
nohup python main.py $FIXED_ARGS --port "$port" --cuda-device "$gpu" &> "$log_file" &
fi
done

# Tail log files from all instances
tail -f "${LOG_FILES[@]}"