Is OpenCL possible with the current Nvidia driver?

I was initially looking for that too, no change for 15 years so not gonna happen :-P Turns out FreeBSD's Linuxlator is already so good it can do this sort of tricks :-)
If I recall correctly, voices requiring native CUDA support on FreeBSD was far more larger (huger?) than now, but it quickly shrunk once it turned out that FreeBSD can run Linux CUDA apps via Linuxulator and linux-nvidia-libs.
So it would be unlikely.

And by my initial experimentation it is very important that nvidia drivers and libs have the same version, so having all this stuff in ports keeps things in sync :-)
This is why I'm habitally sending patches for x11/linux-nvidia-libs with x11/nvidia-driver (and recently graphics/nvidia-drm-[||]-kmod, too) even though I myself am not using x11/linux-nvidia-libs.
 
linux-c7-package_name seems common nomenclature for Linux Centos 7 (thus C7) packages on FreeBSD, see pkg search -x linux-c7, or:


linux-rl9-package_name seems common nomenclature for Rocky Linux 9 (thus RL9) the free and open RedHat successor packages on FreeBSD, see pkg search -x linux-rl9, or:

 
HI , tried to write this info down to gather all the required setup info in one place.
Who is the maintainer of the HANDBOOK for this type of stuff ?
should end up in an extended 5.3 section maybe.

Comments & Additions are welcome / nesseary maybe .......
=======================================================================================

How to set up Nvidia environment on FreeBSD 14 /15

Nivida OpenGL & VDPAU works without linux emulation. To use things like OpenCL, Google-Earth
and CUDA, Linux Emulation needs to be set up in working configuration.

#1 make sure the you have defined :

LINUX_enable="YES" in configuration file /etc/rc.conf

#2 install RockyLinux-9 base system

to make sure that unsuiable linux emulator is not installed from ports or PKG

first Define:

DEFAULT_VERSIONS+= linux=rl9

in Configuration file /etc/make.conf
If you dont have a /etc/make.conf file copy the default version from

/usr/share/examples/etc/make.conf and add

DEFAULT_VERSIONS+= linux=rl9

to the end of the file.
Then Install Rocky Linux 9 Base using Ports or PKG.

/usr/ports/emulators/linux_base-rl9

Reboot you computer .


#3 Setup /etc/fstab to support Linux emulation
The /compat/linux devices is not available until linux emulation is running.

# Device Mountpoint FStype Options Dump Pass#

/dev/gpt/efiboot0 /boot/efi msdosfs rw 2 2
/dev/nda0p3.eli none swap sw 0 0 # swap device-name is machine dependent
fdesc /dev/fd fdescfs rw 0 0
proc /proc procfs rw 0 0
linprocfs /compat/linux/proc linprocfs rw 0 0
linsysfs /compat/linux/sys linsysfs rw 0 0



After yet one more reboot the Linux emulation is fully available.



#4 Install Nvidia driver and tools.

The following PKGs / Ports is to be installed.

x11/nvidia-driver Present driver is version 570.
x11/nvidia-xconfig small utility that generates /etc/X11/xorg.conf
x11/nvidia-xsetting GTK GUI that allows some interactions with the Nvidia GPU
( will install some Gnome Toolkit packages if missing.)
x11/linux-nvidia-libs will install centos7 if linux=rl9 is not defined above. required to install Rocky Linux9 libraries.

graphics/nvidia-drm-kmod Is expected to also install graphics/nvidia-drm-61-kmod.
graphics/nvidia-drm-61-kmod should be auto installed by above.
graphics/nvidia-texture-tools

Multimedia/libva-nvidia-driver to enable firefox additional H/W rendering support-
www/firefox to use/utilize libva-nvidia-driver APIs
( https://github.com/elFarto/nvidia-vaapi-driver?tab=readme-ov-file#direct-backend)

emulators/libc6-shim installs Linux glibc ABI emulation layer.
devel/clinfo to verify OpenCL function.
multimedia/vdpauinfo to verify VDPAU function
astro/google-earth-pro to verify Nviidia Linux graphics emulation.


#5 COnfiguration and setup.

/etc/rc.conf needs the below two operators in kld-list.

kld_list="nvidia-modeset nvidia-drm"

/boot/loader.conf need this sysctl definition to start drm funktion.

hw.nvidiadrm.modeset=1


After Rebooting and starting you favorite Graphic desktop environment you should be able to run these tests :
The Google-earth-pro application should work with full graphics acceleration.
following the advise at : https://github.com/elFarto/nvidia-vaapi-driver?tab=readme-ov-file#direct-backend
will make firefox use your GPU more.

These test are run on a QUADRO Turing mobile T1000 GPU. on FreeBSD 15-current.


$ nv-sglrun nvidia-smi
/usr/local/lib/libc6-shim/libc6.so: shim init
Sat Apr 12 19:57:53 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 570.124.04 Driver Version: 570.124.04 CUDA Version: 12.8 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 Quadro T1000 Off | 00000000:01:00.0 On | N/A |
| N/A 36C P8 5W / 50W | 1074MiB / 4096MiB | 1% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
+-----------------------------------------------------------------------------------------+


$ nv-sglrun clinfo
/usr/local/lib/libc6-shim/libc6.so: shim init
Number of platforms 1
Platform Name NVIDIA CUDA
Platform Vendor NVIDIA Corporation
Platform Version OpenCL 3.0 CUDA 12.8.90
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts cl_khr_gl_event cl_nv_create_buffer cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_nv_kernel_attribute cl_khr_device_uuid cl_khr_pci_bus_info cl_khr_external_semaphore cl_khr_external_memory cl_khr_external_semaphore_opaque_fd cl_khr_external_memory_opaque_fd cl_khr_semaphore
Platform Extensions with Version cl_khr_global_int32_base_atomics 0x400000 (1.0.0)
cl_khr_global_int32_extended_atomics 0x400000 (1.0.0)
cl_khr_local_int32_base_atomics 0x400000 (1.0.0)

( Three scrrens full of data snipped )

$ vdpauinfo
display: :0 screen: 0
API version: 1
Information string: NVIDIA VDPAU Driver Shared Library 570.124.04 Tue Feb 25 03:38:37 UTC 2025

Video surface:

name width height types
-------------------------------------------
420 8192 8192 NV12 YV12
422 8192 8192 UYVY YUYV
444 8192 8192 NV24 YV24
420_16 8192 8192 P010 P016
422_16 8192 8192 UYVY YUYV
444_16 8192 8192 Y_U_V_444_16

( Three scrrens full of data snipped )
 
Back
Top