This is what I did :
# pkg install libc6-shim linux-miniconda-installer linux-c7-devtools linux-c7 linux-c7-libglvnd
# fetch h t t p s : / / g i s t . g i t h u b u s e r c o n t e n t . c o m / shkhln / 40ef290463e78fb2b0000c60f4ad797e / raw / f640983249607e38af405c95c457ce4afc85c608 / uvm_ioctl_override.c
# /compat/linux/usr/bin # ./gcc --sysroot=/compat/linux -m64 -std=c99 -Wall -ldl -fPIC -shared -o /compat/linux/dummy-uvm.so /mnt/da2p2/Backup/uvm_ioctl_override.c
# /compat/linux/usr/bin# cp /compat/linux/dummy-uvm.so /home/marietto
CUDA tests :
- PASSED :
# nv-sglrun nvidia-smi
/usr/local/lib/libc6-shim/libc6.so: shim init
Fri May 9 01:31:16 2025
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.78.01 Driver Version: 525.78.01 CUDA Version: 12.0
- PASSED :
# nv-sglrun ffmpeg -i sample_1280x720_surfing_with_audio.mkv -vcodec hevc_nvenc -acodec copy test.mkv
/usr/local/lib/libc6-shim/libc6.so: shim init
ffmpeg version 6.1.2 Copyright (c) 2000-2024 the FFmpeg developers
built with FreeBSD clang version 18.1.6
configuration: --prefix=/usr/local --mandir=/usr/local/share/man --datadir=/usr/local/share/ffmpeg --docdir=/usr/local/share/doc/ffmpeg --pkgconfigdir=/usr/local/libdata/pkgconfig --disable-static --disable-libcelt --enable-shared --enable-pic --enable-gpl --cc=cc --cxx=c++ --disable-alsa --disable-libopencore-amrnb --disable-libopencore-amrwb --enable-libaom --disable-libaribb24 --disable-libaribcaption --enable-asm --enable-libass --disable-libbs2b --disable-libcaca --disable-libcdio --disable-libcodec2 --enable-libdav1d --disable-libdavs2 --disable-libdc1394 --disable-debug --enable-htmlpages --enable-libdrm --disable-libfdk-aac --disable-libflite --enable-fontconfig --enable-libfreetype --enable-frei0r --disable-libfribidi --disable-gcrypt --disable-libglslang --disable-libgme --enable-gmp --enable-gnutls --enable-version3 --disable-libgsm --enable-libharfbuzz --enable-iconv --disable-libilbc --disable-libjack --enable-libjxl --disable-libklvanc --disable-libkvazaar --disable-ladspa --enable-libmp3lame --enable-lcms2 --disable-liblensfun --disable-libbluray --enable-libplacebo --disable-librsvg --enable-libxml2 --enable-lto --disable-lv2 --disable-mbedtls --disable-libmfx --disable-libmodplug --disable-libmysofa --enable-network --disable-nonfree --enable-nvenc --disable-openal --disable-opencl --disable-opengl --disable-libopenh264 --disable-libopenjpeg --disable-libopenmpt --disable-openssl --disable-libopenvino --enable-optimizations --enable-libopus --disable-pocketsphinx --disable-libpulse --disable-librabbitmq --disable-librav1e --disable-librist --enable-runtime-cpudetect --disable-librubberband --disable-sdl2 --enable-libshaderc --disable-libsmbclient --disable-libsnappy --disable-sndio --disable-libsoxr --disable-libspeex --disable-libsrt --disable-libssh --enable-libsvtav1 --disable-libtensorflow --disable-libtesseract --disable-libtheora --disable-libtwolame --disable-libuavs3d --enable-libv4l2 --enable-vaapi --disable-vapoursynth --enable-vdpau --disable-libvidstab --enable-libvmaf --enable-libvorbis --disable-libvo-amrwbenc --disable-libvpl --enable-libvpx --enable-vulkan --enable-libwebp --enable-libx264 --enable-libx265 --disable-libxavs2 --enable-libxcb --disable-libxvid --disable-outdev=xv --disable-libzimg --disable-libzmq --disable-libzvbi
libavutil 58. 29.100 / 58. 29.100
libavcodec 60. 31.102 / 60. 31.102
libavformat 60. 16.100 / 60. 16.100
libavdevice 60. 3.100 / 60. 3.100
libavfilter 9. 12.100 / 9. 12.100
libswscale 7. 5.100 / 7. 5.100
libswresample 4. 12.100 / 4. 12.100
libpostproc 57. 3.100 / 57. 3.100
Input #0, matroska,webm, from 'sample_1280x720_surfing_with_audio.mkv':
Metadata:
COMPATIBLE_BRANDS: isomiso2avc1mp41
MAJOR_BRAND : mp42
MINOR_VERSION : 512
ENCODER : Lavf58.45.100
Duration: 00:03:03.13, start: 0.000000, bitrate: 3111 kb/s
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)
Metadata:
HANDLER_NAME : VideoHandler
ENCODER : Lavc58.91.100 libx264
DURATION : 00:03:03.061000000
Stream #0:1(eng): Audio: vorbis, 48000 Hz, stereo, fltp (default)
Metadata:
HANDLER_NAME : Stereo
ENCODER : Lavc58.91.100 libvorbis
DURATION : 00:03:03.129000000
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> hevc (hevc_nvenc))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Output #0, matroska, to 'test.mkv':
Metadata:
COMPATIBLE_BRANDS: isomiso2avc1mp41
MAJOR_BRAND : mp42
MINOR_VERSION : 512
encoder : Lavf60.16.100
Stream #0:0: Video: hevc (Main), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 2000 kb/s, 23.98 fps, 1k tbn (default)
Metadata:
HANDLER_NAME : VideoHandler
DURATION : 00:03:03.061000000
encoder : Lavc60.31.102 hevc_nvenc
Side data:
cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: N/A
Stream #0:1(eng): Audio: vorbis (oV[0][0] / 0x566F), 48000 Hz, stereo, fltp (default)
Metadata:
HANDLER_NAME : Stereo
ENCODER : Lavc58.91.100 libvorbis
DURATION : 00:03:03.129000000
[out#0/matroska @ 0x85fa174c0] video:42344kB audio:2371kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: 0.222003%
frame= 4389 fps=669 q=17.0 Lsize= 44815kB time=00:03:03.11 bitrate=2004.9kbits/s speed=27.9x
- PASSED :
marietto@marietto:/usr/home/marietto/Desktop $ nv-sglrun clpeak
/usr/local/lib/libc6-shim/libc6.so: shim init
Platform: NVIDIA CUDA
Device: NVIDIA GeForce RTX 2080 Ti
Driver version : 565.77 (FreeBSD)
Compute units : 68
Clock frequency : 1545 MHz
Global memory bandwidth (GBPS)
float : 505.42
float2 : 533.59
float4 : 549.18
float8 : 551.64
float16 : 491.24
Now let’s see if I’m able to run Stable Diffusion using the driver vers. 565.77 + CUDA Version: 12.7
I’ve followed this tutorial :
h t t p s : / / g i t h u b . c o m / v e r m / freebsd-stable-diffusion ? tab=readme-ov-file#stable-diffusion-webui
(base) I have no name!@marietto:/usr/home/marietto$ conda create --name pytorch python=3.10
Retrieving notices: ...working... done
WARNING: A conda environment already exists at '/home/marietto/miniconda3/envs/pytorch'
Remove existing environment (y/[n])? y
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 22.11.1
latest version: 25.3.1
Please update conda by running
$ conda update -n base -c defaults conda
Or to minimize the number of packages updated during conda update use
conda install conda=25.3.1
## Package Plan ##
environment location: /home/marietto/miniconda3/envs/pytorch
added / updated specs:
- python=3.10
The following NEW packages will be INSTALLED:
_libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main
_openmp_mutex pkgs/main/linux-64::_openmp_mutex-5.1-1_gnu
bzip2 pkgs/main/linux-64::bzip2-1.0.8-h5eee18b_6
ca-certificates pkgs/main/linux-64::ca-certificates-2025.2.25-h06a4308_0
ld_impl_linux-64 pkgs/main/linux-64::ld_impl_linux-64-2.40-h12ee557_0
libffi pkgs/main/linux-64::libffi-3.4.4-h6a678d5_1
libgcc-ng pkgs/main/linux-64::libgcc-ng-11.2.0-h1234567_1
libgomp pkgs/main/linux-64::libgomp-11.2.0-h1234567_1
libstdcxx-ng pkgs/main/linux-64::libstdcxx-ng-11.2.0-h1234567_1
libuuid pkgs/main/linux-64::libuuid-1.41.5-h5eee18b_0
ncurses pkgs/main/linux-64::ncurses-6.4-h6a678d5_0
openssl pkgs/main/linux-64::openssl-3.0.16-h5eee18b_0
pip pkgs/main/noarch::pip-25.1-pyhc872135_2
python pkgs/main/linux-64::python-3.10.16-he870216_1
readline pkgs/main/linux-64::readline-8.2-h5eee18b_0
setuptools pkgs/main/linux-64::setuptools-78.1.1-py310h06a4308_0
sqlite pkgs/main/linux-64::sqlite-3.45.3-h5eee18b_0
tk pkgs/main/linux-64::tk-8.6.14-h39e8969_0
tzdata pkgs/main/noarch::tzdata-2025b-h04d1e81_0
wheel pkgs/main/linux-64::wheel-0.45.1-py310h06a4308_0
xz pkgs/main/linux-64::xz-5.6.4-h5eee18b_1
zlib pkgs/main/linux-64::zlib-1.2.13-h5eee18b_1
Proceed ([y]/n)? y
Downloading and Extracting Packages
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate pytorch
#
# To deactivate an active environment, use
#
# $ conda deactivate
(base) I have no name!@marietto:/usr/home/marietto$ conda update -n base -c defaults conda
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 22.11.1
latest version: 25.3.1
Please update conda by running
$ conda update -n base -c defaults conda
Or to minimize the number of packages updated during conda update use
conda install conda=25.3.1
# All requested packages already installed.
(base) I have no name!@marietto:/usr/home/marietto$ conda activate pytorch
(pytorch) I have no name!@marietto:/usr/home/marietto$ pip install torch==1.12.1+cu113 --extra-index-url h t t p s : / / d o w n l o a d . pytorch . org / whl / cu113
Looking in indexes: h t t p s : / / p y p i . o r g / simple, h t t p s : / / d o w n l o a d . pytorch.org/ whl / cu113
Collecting torch==1.12.1+cu113
Using cached h t t p s : / / d o w n l o a d . pytorch . org /whl / cu113 / torch-1.12.1%2Bcu113-cp310-cp310-linux_x86_64.whl (1837.7 MB)
Collecting typing-extensions (from torch==1.12.1+cu113)
Using cached typing_extensions-4.13.2-py3-none-any.whl.metadata (3.0 kB)
Using cached typing_extensions-4.13.2-py3-none-any.whl (45 kB)
Installing collected packages: typing-extensions, torch
Successfully installed torch-1.12.1+cu113 typing-extensions-4.13.2
(pytorch) I have no name!@marietto:/usr/home/marietto$ LD_PRELOAD="./dummy-uvm.so" python3 -c 'import torch; print(torch.cuda.is_available())'
/home/marietto/miniconda3/envs/pytorch/lib/python3.10/site-packages/torch/cuda/__init__.py:83: UserWarning: CUDA initialization: Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? Error 304: OS call failed or operation not supported on this OS (Triggered internally at ../c10/cuda/CUDAFunctions.cpp:109.)
return torch._C._cuda_getDeviceCount() > 0
False
FAILED : It will work if the nvidia driver is 525 or 535. With an higher version you saw what happens. My suspect is that python 3.10 and/ or torch==1.12.1+cu113 are wrong. Now the ball is in your hand.