Search - User list
Full Version: CUDA_VISIBLE_DEVICES or How to assign GPU?
Root » Technical Discussion » CUDA_VISIBLE_DEVICES or How to assign GPU?
kilian89
Hello artists & tech people

I am running Rocky Linux 9.6 with two 4090 GPUs. I want to assign second GPU to Houdini - mostly for it's VRAM.
No matter what I do, Houdini still uses 1st GPU which is connected to display.

I have tried:
  • Setting env variables in ~/home directory: HOUDINI_OCL_DEVICENUMBER = 1, HOUDINI_GPU_DEVICE = 1, HOUDINI_GL_GPU = 1
  • Setting the env variable from CLI and launching Houdini from there: export CUDA_VISIBLE_DEVICES=1, ./houdini
  • Setting GPU preference inside Houdini: Preferences > Miscellaneous > GPU selection

In all of these options Houdini utilises mostly DEVICE 0 (1st GPU connected to monitor and it's RAM) Second GPU (DEVICE 1, which I intend to use) is used by Houdini with minimal impact.

Why all this hassle: simply because I want to assign Unreal Engine and Houdini between different GPUs and avoid VRAM exhaustion.
Both GPUs are detected by system, and are powered on.

Any tips how do I debug this issue?
kilian89
Update: I ended up with making cgroup for process-specific device isolation. Testing how it works. Maybe helps someone.

#!/bin/bash
# Save as ~/bin/houdini-cgroup-isolated.sh

# Create a device cgroup for Houdini
CGROUP_NAME="houdini-gpu1-$$"

# Create cgroup (requires systemd)
systemd-run --user --scope \
  --unit="houdini-gpu1-$RANDOM" \
  --property="DevicePolicy=strict" \
  --property="DeviceAllow=/dev/nvidia1 rw" \
  --property="DeviceAllow=/dev/nvidiactl rw" \
  --property="DeviceAllow=/dev/nvidia-uvm rw" \
  --property="DeviceAllow=/dev/nvidia-uvm-tools rw" \
  --property="DeviceAllow=/dev/char/226:1 rw" \
  --setenv=CUDA_VISIBLE_DEVICES=1 \
  /opt/hfs20.5.584/bin/houdini "$@"
kilian89
Update 2: For anyone interested, the cgroup approach works well, tested with Fusion Resolve and Houdini running on Device 1. Unreal running on Device 0. Both VRAMs utilised

Great thing is that now Linux runs Unreal + Houdini Engine session on one GPU, while having another Houdini instance running on 2nd GPU
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB