# CUDA



## grahamperrin@ (Apr 24, 2022)

```
% pwd
/usr/home/grahamperrin/dev/gpufetch
% echo $0
/bin/tcsh
% ./build.sh
-- The CXX compiler identification is Clang 13.0.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for a CUDA compiler
-- Looking for a CUDA compiler - NOTFOUND
-- Found PCIUTILS: /usr/local/lib/libpci.so 
-- ----------------------
-- gpufetch build report:
-- CUDA backend: OFF
-- Intel backend: ON
-- ----------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /home/grahamperrin/dev/gpufetch/build
[ 25%] Building CXX object CMakeFiles/intel_backend.dir/src/intel/udev.cpp.o
[ 25%] Building CXX object CMakeFiles/intel_backend.dir/src/intel/intel.cpp.o
[ 25%] Building CXX object CMakeFiles/intel_backend.dir/src/intel/uarch.cpp.o
[ 25%] Building CXX object CMakeFiles/intel_backend.dir/src/intel/pci.cpp.o
[ 31%] Building CXX object CMakeFiles/intel_backend.dir/src/intel/cpuid.cpp.o
[ 37%] Linking CXX static library libintel_backend.a
[ 37%] Built target intel_backend
[ 56%] Building CXX object CMakeFiles/gpufetch.dir/src/common/gpu.cpp.o
[ 56%] Building CXX object CMakeFiles/gpufetch.dir/src/common/main.cpp.o
[ 56%] Building CXX object CMakeFiles/gpufetch.dir/src/common/args.cpp.o
[ 62%] Building CXX object CMakeFiles/gpufetch.dir/src/common/pci.cpp.o
[ 68%] Building CXX object CMakeFiles/gpufetch.dir/src/common/sort.cpp.o
[ 75%] Building CXX object CMakeFiles/gpufetch.dir/src/common/global.cpp.o
[ 81%] Building CXX object CMakeFiles/gpufetch.dir/src/common/printer.cpp.o
[ 87%] Building CXX object CMakeFiles/gpufetch.dir/src/common/master.cpp.o
[ 93%] Building CXX object CMakeFiles/gpufetch.dir/src/common/uarch.cpp.o
[100%] Linking CXX executable gpufetch
[100%] Built target gpufetch
% ./gpufetch
[ERROR]: No GPU was detected! Available GPUs are:
- GPU 0: AMD 1002:6841
Please, make sure that the appropiate backend is enabled:
- CUDA backend:  OFF
- Intel backend: ON
Visit https://github.com/Dr-Noob/gpufetch#2-backends for more information
% pkg provides /cuda/bin/nvcc
% pkg provides bin/nvcc
Name    : kokkos-3.5.00
Desc    : C++ performance portability programming ecosystem
Repo    : FreeBSD
Filename: usr/local/bin/nvcc_wrapper
% which nvcc
nvcc: Command not found.
%
```

From <https://github.com/Dr-Noob/gpufetch#21-cuda-backend-is-not-enabled-why> (for example): 

`cmake -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc -DCMAKE_CUDA_COMPILER_TOOLKIT_ROOT=/usr/local/cuda/ ..`

– is this, or something like it, possible with FreeBSD?









						CUDA
					

I understand that FreeBSD supports NVidia graphics cards, via binary distribution from NVidia themselves, but, I was just wondering what the blocker is to a CUDA library on FreeBSD, anyone know? Is it just NVidia chose not to release CUDA for FreeBSD?




					forums.freebsd.org
				












						general/other - Using Linux Emuation as a means to utilize CUDA.
					

I was tasked with seeing the viability of FreeBSD as a workspace as we need to shift away from CentOS. FreeBSD obviously does not have official support for CUDA drivers, however I was told it "could" make use of CentOS emulation which I was asked to try. If it is completely impossible to...




					forums.freebsd.org


----------



## grahamperrin@ (Apr 24, 2022)

MichaelL Oko inf3rno OSExplorer

_CUDA framework support_ under <https://wiki.freebsd.org/2021FoundationCFI#Graphics> originally added by jrm@









						Call for Foundation-supported Project Ideas
					

Hello all,  There is a thread on the freebsd-hackers@freebsd.org mailing list seeking project ideas.  If you have ideas about projects that the Foundation could support, please leave your feedback.  -- Joe (with Foundation hat on)




					forums.freebsd.org
				




From FreeBSD In Scientific Computing FreeBSD Journal ME July/August 2018:



> … In order for FreeBSD to become a competitive platform in HPC, it would also need to more easily support a few other subsystems that currently only work well on Linux, such as nVidia's CUDA GPU platform (although the open standard OpenCL is beginning to gain traction) and …


----------



## shkhln (Apr 24, 2022)

And?


----------



## drhowarddrfine (Apr 24, 2022)

shkhln said:


> And?


Bippity boppity boo. Put 'em together and what have you got?


----------



## kpedersen (Apr 24, 2022)

drhowarddrfine said:


> Bippity boppity boo. Put 'em together and what have you got?


Ooh, I know this one!

 Another spammy set of posts containing nothing but a bunch of completely disjointed internet links


----------



## Zare (Apr 24, 2022)

It's like people think that feature is magically going to happen if they ask about it all the time.

People who tinkered with PoC by themselves clearly wrote what kind of effort is needed to get the feature. That effort is not going to get organized on an user support forum.

The target audience needs to fund the development or push NVidia for support.


----------



## shkhln (Apr 24, 2022)

That audience should package a sufficiently popular GPU computing app first, like Tensorflow. We need to organize our efforts around a few clear targets, this is going nowhere otherwise. (Same goes for Intel and AMD stuff.)



Zare said:


> People who tinkered with PoC by themselves clearly wrote what kind of effort is needed to get the feature.


PoC was eventually replaced by the proper driver code: https://forums.developer.nvidia.com/t/cuda-and-nv-un-register-os-un-lock-user-pages/174678. Of course, we still need a workaround for userspace libs. For now.

That doesn't get us full CUDA support, but we can run OpenCL apps at least (with x11/nvidia-driver, x11/linux-nvidia-libs and the nv-sglrun script from emulators/libc6-shim). And NVENC if you bother to compile it.


----------



## grahamperrin@ (Apr 24, 2022)

Thanks, 



Zare said:


> … ask about it all the time. …



Maybe some misunderstanding. 

I can't speak for the other people who wrote in previous topics, but as far as I can tell I mentioned CUDA just *once* in the past, and that was: 

not _me asking about it_
– that one occasion was me quoting someone else. 

The previous topic <https://forums.freebsd.org/threads/49653/> with an identical title (CUDA) is not a good point of reference because additional discussion there will probably disappear.


For anyone with a technical interest: I stumbled across the _CUDA backend_ context following a fix to a utility for it to compile on FreeBSD.









						[v0.23] Fix FreeBSD compilation issues as reported by #13 · Dr-Noob/gpufetch@6f196c1
					

Simple yet fancy GPU architecture fetching tool. Contribute to Dr-Noob/gpufetch development by creating an account on GitHub.




					github.com
				




Then, found the _CUDA framework support_ idea, which had been added by jrm@ (Joseph Mingrone, Project Coordinator, FreeBSD Foundation). The listing was one of the few that *lacked a point of reference*, so yesterday <https://wiki.freebsd.org/action/info/2021FoundationCFI?action=diff&rev2=41&rev1=40> I added the link to this (necessarily new) topic. 

It's unfortunate that topics must be duplicated/split, but that's not my decision.

Incidentally, I don't see Joseph Mingrone asking about CUDA _all the time_; I see no mention of CUDA in Call for Foundation-supported Project Ideas, the topic that preceded the page in the wiki. 

(Do people sometimes ask him about CUDA framework support? I have no idea.)

HTH


----------

