Deploying blender on serverless doesn't utilize GPU

I am using Dockerfile to create a serverless instance with blender. Problem is the telemetry shows my GPU utilization is 0. Testing same code in local it utilizes the GPU. How i can be sure that serverless is not utilizing GPU is the time taken on 5090 (serverless) > 4070 (local machine) and how logs gets stuck where my GPU utilization spikes in local machine. i have attached a telemetry image which shows utilization is 0 when i encounter same sets of logs. compared to spikes seen in local machine. here is my dockerfile
FROM ubuntu:22.04

RUN apt-get update && apt-get install -y \
wget \
xz-utils \
python3 \
python3-pip \
libxrender1 \
libxi6 \
libxext6 \
libx11-6 \
libgl1-mesa-glx \
libxkbcommon0 \
libsm6 \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /opt
RUN wget -q https://download.blender.org/release/Blender4.2/blender-4.2.1-linux-x64.tar.xz \
&& tar -xf blender-4.2.1-linux-x64.tar.xz \
&& rm blender-4.2.1-linux-x64.tar.xz \
&& mv blender-4.2.1-linux-x64 blender

ENV PATH="/opt/blender:$PATH"

WORKDIR /app

COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt

COPY scripts/ ./scripts/
COPY src/ ./src/

ENV PYTHONPATH="/app/scripts:$PYTHONPATH"

EXPOSE 8000

CMD ["python3", "src/app.py"]
FROM ubuntu:22.04

RUN apt-get update && apt-get install -y \
wget \
xz-utils \
python3 \
python3-pip \
libxrender1 \
libxi6 \
libxext6 \
libx11-6 \
libgl1-mesa-glx \
libxkbcommon0 \
libsm6 \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /opt
RUN wget -q https://download.blender.org/release/Blender4.2/blender-4.2.1-linux-x64.tar.xz \
&& tar -xf blender-4.2.1-linux-x64.tar.xz \
&& rm blender-4.2.1-linux-x64.tar.xz \
&& mv blender-4.2.1-linux-x64 blender

ENV PATH="/opt/blender:$PATH"

WORKDIR /app

COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt

COPY scripts/ ./scripts/
COPY src/ ./src/

ENV PYTHONPATH="/app/scripts:$PYTHONPATH"

EXPOSE 8000

CMD ["python3", "src/app.py"]
No description
No description
Solution:
I have figured out the issue and it had to do more with the blender version. Apparently 4.2.1 does not sit well with using GPU and CPU compared to other later versions. Switching to 4.3.2 made significant improvements in the time. According to web Blender 4.3.2 is the successor to 4.2 LTS, bringing significant usability improvements, a rewritten Grease Pencil engine for better performance, and a more flexible windowing system to Blender run pod 1st image...
No description
No description
Jump to solution
3 Replies
Dj
Dj5w ago
I'd recommend trying FROM an nvidia base image just so you're certain you have all the relevant graphics drivers?
simpereshwar
simpereshwarOP4w ago
The gpu is utilized but realtime updates are not very consistent with telemetry. Also there might something preenting 100% utilization of GPUs so on the application end fixed somethings causing issues
Solution
simpereshwar
simpereshwar4w ago
I have figured out the issue and it had to do more with the blender version. Apparently 4.2.1 does not sit well with using GPU and CPU compared to other later versions. Switching to 4.3.2 made significant improvements in the time. According to web Blender 4.3.2 is the successor to 4.2 LTS, bringing significant usability improvements, a rewritten Grease Pencil engine for better performance, and a more flexible windowing system to Blender run pod 1st image local machine 2nd image
No description
No description

Did you find this page helpful?