Can CUDA be installed on FreeBSD now ?

I've just read this thread :
Took you a while.

where has been asked to modify the code of the freebsd driver to support CUDA. I read that it has been done. So,now can we install CUDA on FreeBSD by installing first a linux distro with the linuxulator and then the proper cuda package ? does it will work ? thanks.
 
Interesting. I've already seen that error "no GPU detected",when I tried to passthru my nvidia gpu inside a linux vm using bhyve. We have found what was missing on bhyve. Infact the nvidia driver wanted to find some components and the developers who have collaborated with me created the necessary patches. I'm not experienced,but I suspect that the gpu could be found with the same patches (or with some of them) created to allow bhyve to accept the nvidia driver. There is even a a protection mechanism inside of it. I should ask to my favorite bhyve developer.
 
I can do it,if you have the patience to explain in easy understandable terms what you think. Unfortunately I haven't any programming knowledge. Usually I understand things by making multiple experiments,comparing the results and excluding the unuseful variables. Do you have a vague idea about how much efforts are needed to use my approach ? So,I really need to understand what happens under the hood at some theoretical level.
 
Can some one tell me what to do to install CUDA correctly ?

Code:
mario@marietto:/home/mario# sudo apt install nvidia-cuda-toolkit

Reading package lists... Done
Building dependency tree    
Reading state information... Done
The following packages were automatically installed and are no longer required:
dkms libegl-dev libglu1-mesa-dev libqt5concurrent5 libqt5opengl5 libqt5opengl5-dev libqt5sql5
libqt5sql5-sqlite libvulkan-dev libxext-dev linux-headers-5.4.0-26
linux-headers-5.4.0-26-generic linux-headers-generic qt5-default qt5-qmake qt5-qmake-bin
qtbase5-dev qtbase5-dev-tools qtchooser x11proto-xext-dev
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
g++-8 libaccinj64-10.1 libcublas10 libcublaslt10 libcudart10.1 libcufft10 libcufftw10
libcuinj64-10.1 libcupti-dev libcupti-doc libcupti10.1 libcurand10 libcusolver10 libcusolvermg10
libcusparse10 libjs-underscore libncurses5 libnppc10 libnppial10 libnppicc10 libnppicom10
libnppidei10 libnppif10 libnppig10 libnppim10 libnppist10 libnppisu10 libnppitc10 libnpps10
libnvblas10 libnvgraph10 libnvidia-compute-435 libnvidia-ml-dev libnvjpeg10 libnvrtc10.1
libnvtoolsext1 libnvvm3 libstdc++-8-dev libthrust-dev libtinfo5 libvdpau-dev node-html5shiv
nsight-compute nsight-systems nvidia-cuda-dev nvidia-cuda-doc nvidia-cuda-gdb nvidia-opencl-dev
nvidia-profiler nvidia-visual-profiler ocl-icd-opencl-dev opencl-c-headers
Suggested packages:
g++-8-multilib gcc-8-doc libstdc++-8-doc libvdpau-doc nodejs nvidia-driver
| nvidia-tesla-440-driver | nvidia-tesla-418-driver libpoclu-dev
Recommended packages:
libnvcuvid1
The following NEW packages will be installed:
g++-8 libaccinj64-10.1 libcublas10 libcublaslt10 libcudart10.1 libcufft10 libcufftw10
libcuinj64-10.1 libcupti-dev libcupti-doc libcupti10.1 libcurand10 libcusolver10 libcusolvermg10
libcusparse10 libjs-underscore libncurses5 libnppc10 libnppial10 libnppicc10 libnppicom10
libnppidei10 libnppif10 libnppig10 libnppim10 libnppist10 libnppisu10 libnppitc10 libnpps10
libnvblas10 libnvgraph10 libnvidia-compute-435 libnvidia-ml-dev libnvjpeg10 libnvrtc10.1
libnvtoolsext1 libnvvm3 libstdc++-8-dev libthrust-dev libtinfo5 libvdpau-dev node-html5shiv
nsight-compute nsight-systems nvidia-cuda-dev nvidia-cuda-doc nvidia-cuda-gdb
nvidia-cuda-toolkit nvidia-opencl-dev nvidia-profiler nvidia-visual-profiler ocl-icd-opencl-dev
opencl-c-headers
0 upgraded, 53 newly installed, 0 to remove and 0 not upgraded.
Need to get 1399 MB of archives.
After this operation, 3750 MB of additional disk space will be used.
Do you want to continue? [Y/n] y


mario@marietto:/home/mario# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243

mario@marietto:/home/mario# nvidia-smi
Could not find command-not-found database. Run 'sudo apt update' to populate it.
nvidia-smi: command not found

mario@marietto:/home/mario# apt install nvidia-settings

Reading package lists... Done
Building dependency tree    
Reading state information... Done

The following additional packages will be installed:
python3-xkit screen-resolution-extra
The following NEW packages will be installed:
nvidia-settings python3-xkit screen-resolution-extra



mario@marietto:/home/mario# nvidia-smi              
Could not find command-not-found database. Run 'sudo apt update' to populate it.
nvidia-smi: command not found

mario@marietto:/home/mario# nvidia-settings
nvidia-settings: error while loading shared libraries: libXNVCtrl.so.0: cannot open shared object file: No such file or directory

mario:/home/mario# apt install nvidia-driver-440

Reading package lists... Done
Building dependency tree        
Reading state information... Done

The following additional packages will be installed:
  libnvidia-cfg1-440 libnvidia-common-440 libnvidia-compute-440 libnvidia-decode-440
  libnvidia-encode-440 libnvidia-extra-440 libnvidia-fbc1-440 libnvidia-gl-440 libnvidia-ifr1-440
  nvidia-compute-utils-440 nvidia-dkms-440 nvidia-kernel-common-440 nvidia-kernel-source-440
  nvidia-prime nvidia-utils-440 xserver-xorg-video-nvidia-440

Get:17 http://archive.ubuntu.com/ubuntu focal/main amd64 nvidia-prime all 0.8.14 [9164 B]          
Fetched 101 MB in 31s (3204 kB/s)                                                                  
dpkg: libnvidia-compute-435:amd64: dependency problems, but removing anyway as you requested:
 libcuinj64-10.1:amd64 depends on libcuda1 (>= 418.39) | libnvidia-tesla-cuda1 (>= 418.39) | libcuda
.so.1 (>= 418.39) | libcuda-10.1-1; however:
  Package libcuda1 is not installed.
  Package libnvidia-compute-435:amd64 which provides libcuda1 is to be removed.
  Package libnvidia-tesla-cuda1 is not installed.
  Package libcuda.so.1 is not installed.
  Package libcuda-10.1-1 is not installed.
  Package libnvidia-compute-435:amd64 which provides libcuda-10.1-1 is to be removed.
 libcuinj64-10.1:amd64 depends on libcuda1 (>= 418.39) | libnvidia-tesla-cuda1 (>= 418.39) | libcuda
.so.1 (>= 418.39) | libcuda-10.1-1; however:
  Package libcuda1 is not installed.
  Package libnvidia-compute-435:amd64 which provides libcuda1 is to be removed.
  Package libnvidia-tesla-cuda1 is not installed.
  Package libcuda.so.1 is not installed.
  Package libcuda-10.1-1 is not installed.
  Package libnvidia-compute-435:amd64 which provides libcuda-10.1-1 is to be removed.
 libnvidia-ml-dev depends on libnvidia-ml1 (>= 418.39) | libnvidia-tesla-440-ml1 (>= 418.39) | libnv
idia-tesla-418-ml1 (>= 418.39) | libnvidia-ml.so.1 (>= 418.39); however:
  Package libnvidia-ml1 is not installed.
  Package libnvidia-compute-435:amd64 which provides libnvidia-ml1 is to be removed.
  Package libnvidia-tesla-440-ml1 is not installed.
  Package libnvidia-tesla-418-ml1 is not installed.
  Package libnvidia-ml.so.1 is not installed.

Setting up libnvidia-cfg1-440:amd64 (440.82+really.440.64-0ubuntu6) ...
Setting up nvidia-kernel-source-440 (440.82+really.440.64-0ubuntu6) ...
Setting up nvidia-prime (0.8.14) ...
Setting up libnvidia-extra-440:amd64 (440.82+really.440.64-0ubuntu6) ...
Setting up libnvidia-common-440 (440.82+really.440.64-0ubuntu6) ...
Setting up libnvidia-fbc1-440:amd64 (440.82+really.440.64-0ubuntu6) ...
Setting up libnvidia-compute-440:amd64 (440.82+really.440.64-0ubuntu6) ...
Setting up nvidia-kernel-common-440 (440.82+really.440.64-0ubuntu6) ...
Setting up xserver-xorg-video-nvidia-440 (440.82+really.440.64-0ubuntu6) ...
Setting up libnvidia-decode-440:amd64 (440.82+really.440.64-0ubuntu6) ...
Setting up nvidia-utils-440 (440.82+really.440.64-0ubuntu6) ...
Setting up libnvidia-gl-440:amd64 (440.82+really.440.64-0ubuntu6) ...
Setting up nvidia-compute-utils-440 (440.82+really.440.64-0ubuntu6) ...
Warning: The home dir /nonexistent you specified can't be accessed: No such file or directory
Adding system user `nvidia-persistenced' (UID 116) ...
Adding new group `nvidia-persistenced' (GID 125) ...
Adding new user `nvidia-persistenced' (UID 116) with group `nvidia-persistenced' ...
Not creating home directory `/nonexistent'.
Setting up nvidia-dkms-440 (440.82+really.440.64-0ubuntu6) ...
INFO:Enable nvidia
DEBUG:/usr/share/ubuntu-drivers-common/quirks does not exist
/var/lib/dpkg/info/nvidia-dkms-440.postinst: 140: /usr/lib/dkms/common.postinst: not found
dpkg: error processing package nvidia-dkms-440 (--configure):
 installed nvidia-dkms-440 package post-installation script subprocess returned error exit status 12
7
Setting up libnvidia-encode-440:amd64 (440.82+really.440.64-0ubuntu6) ...
dpkg: dependency problems prevent configuration of nvidia-driver-440:
 nvidia-driver-440 depends on nvidia-dkms-440 (= 440.82+really.440.64-0ubuntu6) | nvidia-dkms-440 (=
 440.82+really.440.64-0ubuntu4); however:
  Package nvidia-dkms-440 is not configured yet.
  Version of nvidia-dkms-440 on system is 440.82+really.440.64-0ubuntu6.

dpkg: error processing package nvidia-driver-440 (--configure):
 dependency problems - leaving unconfigured
Setting up libnvidia-ifr1-440:amd64 (440.82+really.440.64-0ubuntu6) ...
Processing triggers for man-db (2.9.1-1) ...
No apport report written because the error message indicates its a followup error from a previous fa
ilure.
      Processing triggers for libc-bin (2.31-0ubuntu9) ...
Errors were encountered while processing:
 nvidia-dkms-440
 nvidia-driver-440
E: Sub-process /usr/bin/dpkg returned an error code (1)
 
explain in easy understandable terms
I was under impression I'm already doing that. There are multiple pieces involved: a few kernel modules (nvidia.ko and nvidia-uvm.ko), core (libcuda.so) and additional (libcufft.so and so on) shared libs and, of course, the compiler (nvcc). The aforementioned change specifically addresses the bit of code required to use libcuda.so, but not necessarily any other components. Whether that is enough for you depends on the particular application you want to use. Say, Darktable (an OpenCL application) and OBS Studio should be usable already (with my userspace hack, that is), on the other hand Blender requires nvcc, so it wouldn't be.
 
Thanks. Now I understand a little bit more. I'm interested in running for example Blender and Maya. So,for me the problem is how to run nvcc. yesterday I have installed nvcc :


Code:
mario@marietto:/home/mario# nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243

so,can you explain in which context nvcc should run ? because as u can see within the linuxulator it works. And if works with it,is it really hard to make it work even natively ? what are the piece of code missing ? Im really interested also to try your userspace hack).
 
So far:
  1. nvcc should be available at /usr/local/cuda/bin/nvcc.
  2. Blender should be started with env CYCLES_CUDA_EXTRA_CFLAGS="-ccbin /path/to/cc-wrapper.sh" nv-sglrun blender
  3. cc-wrapper.sh looks like:
    Code:
    #!/bin/sh
    exec env /compat/linux/bin/env PATH="/compat/linux/bin:$PATH" /compat/linux/opt/rh/devtoolset-9/root/usr/bin/gcc --sysroot /compat/linux "$@"
  4. That version of Linux gcc was installed from the devtoolset-9-gcc-9.3.1_1 CentOS package, which isn't actually available as a port. I'm not going to submit it.
 
If I have understood correctly,before to use the wrapper,I should apply your userspace hack ? Where is located and how can I install it ?
 
Code:
mario@marietto:/home/marietto/Desktop/Files/CUDA/libc6-shim/bin # ./nv-sglrun nvidia-smi

shim init
Wed Jul 20 20:05:51 2022       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 510.60.02    Driver Version: 510.60.02    CUDA Version: 11.6     |
|-------------------------------+----------------------+----------------------+
| 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  NVIDIA GeForce ...  Off  | 00000000:02:00.0 Off |                  N/A |
| 46%   63C    P0    77W / 250W |      0MiB / 11264MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
 
ziomario

Please stop deleting the contents of your posts and replacing it with "a".

If your content is not worth keeping alive don't post it to begin.
If you accidentially posted something worth deleting (such as "sensitive" information) ask staff to delete the post.

The content that I have posted was good at the beginning,but then it stopped to be valid. I can't remove it by myself,so I have temporarely changed it with a letter. Now I'm going to report it,but I presume that you know that this procedure can't be immediate,since I can't remove the post by myself. I know what to do. Stop to tell me stop. If you want the content to be removed faster,change the method. Allow me to remove it by my self and I will be faster.
 
Allow me to remove it by my self and I will be faster.
No, just don't post stuff that is "invalid" within the blink of an eye.

It happens to everyone once in a while. There is in general nothing wrong to post something and following up later that the previous information no longer applies, was incorrect or anything along those lines.
The "issue" is that you seem to just post whatever whenever.

This forum is not a race. You don't get extra points for posting more or faster. In fact, if anything, quite the contrary.
 
Post removal was working just fine not so long ago, which means it either was broken on the forum upgrade or was massively abused and thus disabled. SirDice, any idea?
 
No, just don't post stuff that is "invalid" within the blink of an eye.

It happens to everyone once in a while. There is in general nothing wrong to post something and following up later that the previous information no longer applies, was incorrect or anything along those lines.
The "issue" is that you seem to just post whatever whenever.

This forum is not a race. You don't get extra points for posting more or faster. In fact, if anything, quite the contrary.

I disagree with you. Only two posts were not valid. I meant that it does not depend by me the speed with which the post is removed. I don't want to make a challenge with anyone. Make a phone call to the moderator and tell him to be faster. And I can't know from the beginning which contents will be invalid after some time.
 
or was massively abused and thus disabled.
Aye, this was the reason. So deleting has been limited. You should still be able to delete the occasional post, we've all posted something and immediately regretted it. Mass deletions however aren't possible any more.

I disagree with you.
I strongly suggest listening to jbodenmann

And I can't know from the beginning which contents will be invalid after some time.
Sure, but then it's more proper to do a follow-up post, which explains what was wrong. You don't go around posting willy-nilly, then removing said posts because you think they were "wrong".
 
Aye, this was the reason. So deleting has been limited. You should still be able to delete the occasional post, we've all posted something and immediately regretted it. Mass deletions however aren't possible any more.

if someone wants to remove two posts in a row,it is considered a mass deletion ?
 
Anyway,coming back to the thread,I tried to install the devtoolset inside the centos distro,with this command :

Code:
bash-4.2# rpm -i devtoolset-9-gcc-9.3.1-2.2.el7.x86_64.rpm
bash: rpm: command not found

but I see that I can't do it. Can you explain a little bit how can I install rpm ? thanks.
 
Maybe convert it using alien


Code:
bash-4.2# apt-get install
bash: apt-get: command not found

bash-4.2# ping google.it
bash: ping: command not found

inside the centos distribution installed by shkhln a lot of components are missing. Converting the rpm package to deb for achieving which purpoise ?
 
Ok. A little of creativity. I've used an ubuntu 20.04 distro,instead of the centos and I have changed the wrapper script like this :

Code:
#!/bin/sh
exec env /compat/ubuntu/usr/bin/env PATH="/compat/ubuntu/bin:$PATH" /compat/ubuntu/usr/bin/gcc --sysroot /compat/ubuntu "$@"

and then I've ran it :

Code:
# ./cuda-blender-wrapper

gcc: fatal error: no input files
compilation terminated.

maybe it worked. But now,what should I do ? keep in consideration that what I want to do is that blender recognizes the CUDA libraries and then it can uses them to render my projects.
 
Back
Top