§2024-12-10

sudo apt install libopencv-dev=4.8.0-1-g6371ee1
alexlai@jetsonOrinNano:~$ apt-cache policy libopencv-dev
libopencv-dev:
  Installed: 4.5.4+dfsg-9ubuntu4
  Candidate: 4.8.0-1-g6371ee1
  Version table:
     4.8.0-1-g6371ee1 600
        600 https://repo.download.nvidia.com/jetson/common r36.4/main arm64 Packages
 *** 4.5.4+dfsg-9ubuntu4 500
        500 http://ports.ubuntu.com/ubuntu-ports jammy/universe arm64 Packages
        100 /var/lib/dpkg/status
alexlai@jetsonOrinNano:~$ sudo apt-mark unhold libopencv-dev
libopencv-dev was already not on hold.
sudo apt install libnvidia-compute-535

I got a Jetson Orin Nano installed with Nvidia SDK manager running Ubuntu 22.04, and would like to use R with these GPU.  And I have R 4.4.2 installed, how to verify my Jetson devloment boad is setup correctly and I could usW R to do some work?

1. Verify Jetson Orin Nano Setup

alexlai@jetsonOrinNano:~$ cat /etc/nv_tegra_release

R36 (release), REVISION: 4.0, GCID: 37537400, BOARD: generic, EABI: aarch64, DATE: Fri Sep 13 04:36:44 UTC 2024

KERNEL_VARIANT: oot

TARGET_USERSPACE_LIB_DIR=nvidia TARGET_USERSPACE_LIB_DIR_PATH=usr/lib/aarch64-linux-gnu/nvidia

alexlai@jetsonOrinNano:~$ nvidia-smi Tue Dec 10 10:37:51 2024
+---------------------------------------------------------------------------------------+ | NVIDIA-SMI 540.4.0 Driver Version: 540.4.0 CUDA Version: 12.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 Orin (nvgpu) N/A | N/A N/A | N/A | | N/A N/A N/A N/A / N/A | Not Supported | N/A N/A | | | 25-R_LIBS_USER | N/A | +-----------------------------------------+----------------------+----------------------+

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


2. Check CUDA Installation

alexlai@jetsonOrinNano:~$ nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2021 NVIDIA Corporation Built on Thu_Nov_18_09:45:25_PST_2021 Cuda compilation tools, release 11.5, V11.5.119 Build cuda_11.5.r11.5/compiler.30672275_0

alexlai@jetsonOrinNano:~$ ls /usr/local/cuda

alexlai@jetsonOrinNano:~$ ls -l /usr/local/cuda/bin/ total 0 lrwxrwxrwx 1 root root 13 十二 10 09:36 nvcc -> /usr/bin/nvcc


3. Install R and GPU-Compatible Libraries

alexlai@jetsonOrinNano:~$ R

R version 4.4.2 (2024-10-31) -- "Pile of Leaves" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: aarch64-unknown-linux-gnu

R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.25-R_LIBS_USER Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R.

install.packages("gpuR") Installing package into ‘/home/alexlai/R/aarch64-unknown-linux-gnu-library/4.4’

.... Creating a generic function for ‘colnames<-’ from package ‘base’ in package ‘gpuR’ ** help *** installing help indices ** building package indices ** installing vignettes ** testing if installed package can be loaded from temporary location Error: package or namespace load failed for ‘gpuR’: .onAttach failed in attachNamespace() for 'gpuR', details: call: NULL error: ViennaCL: FATAL ERROR: ViennaCL encountered an unknown OpenCL error. Most likely your OpenCL SDK or driver is not installed properly. In some cases, this error is due to an invalid global work size or several kernel compilation errors. If you think that this is a bug in ViennaCL, please report it at viennacl-support@lists.sourceforge.net and supply at least the following information:

The downloaded source packages are in ‘/tmp/RtmpIzzfTG/downloaded_packages’ Warning message: In install.packages("gpuR") : installation of package ‘gpuR’ had non-zero exit status ^@nstall.packages("gpuR")

Save workspace image? [y/n/c]: n alexlai@jetsonOrinNano:~$ clinfo Number of platforms 0 <-- The output Number of platforms: 0 indicates that OpenCL is not correctly installed or configured on your Jetson Orin Nano.


----

&para;OpenCV

- try to fix clinfo returns 0

alexlai@jetsonOrinNano:~$ clinfo Number of platforms 0 <-- The output Number of platforms: 0


1. check /etc/nv_tegra_release

alexlai@jetsonOrinNano:~$ cat /etc/nv_tegra_release

R36 (release), REVISION: 4.0, GCID: 37537400, BOARD: generic, EABI: aarch64, DATE: Fri Sep 13 04:36:44 UTC 2024

KERNEL_VARIANT: oot

TARGET_USERSPACE_LIB_DIR=nvidia TARGET_USERSPACE_LIB_DIR_PATH=usr/lib/aarch64-linux-gnu/nvidia


2.  nvcc --version

alexlai@jetsonOrinNano:~$ nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2021 NVIDIA Corporation Built on Thu_Nov_18_09:45:25_PST_2021 Cuda compilation tools, release 11.5, V11.5.119 Build cuda_11.5.r11.5/compiler.30672275_0


3. Reinstall OpenCL Libraries

alexlai@jetsonOrinNano:~$ sudo apt-get update && sudo apt-get install nvidia-opencl-dev [sudo] password for alexlai: Hit:1 https://repo.download.nvidia.com/jetson/common r36.4 InRelease
Hit:2 https://repo.download.nvidia.com/jetson/t234 r36.4 InRelease
Get:3 http://rig.r-pkg.org/deb rig InRelease
Hit:4 https://repo.download.nvidia.com/jetson/ffmpeg r36.4 InRelease
Hit:5 http://ports.ubuntu.com/ubuntu-ports jammy InRelease
Get:6 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease [128 kB] Hit:7 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease Get:8 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease [129 kB] Fetched 260 kB in 3s (92.4 kB/s) Reading package lists... Done Reading package lists... Done Building dependency tree... Done Reading state information... Done nvidia-opencl-dev is already the newest version (11.5.1-1ubuntu1). nvidia-opencl-dev set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.


4.  reinstall nvidia-cuda-toolkit

alexlai@jetsonOrinNano:~$ sudo apt-get install nvidia-cuda-toolkit Reading package lists... Done Building dependency tree... Done Reading state information... Done nvidia-cuda-toolkit is already the newest version (11.5.1-1ubuntu1). 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.


5. sudo reboot

$ sudo reboot now


6.  clinfo is still zero

alexlai@jetsonOrinNano:~$ clinfo Number of platforms 0


---

1. 

alexlai@jetsonOrinNano:~$ sudo apt-get install nvidia-opencl-icd [sudo] password for alexlai: Reading package lists... Done Building dependency tree... Done Reading state information... Done Package nvidia-opencl-icd is a virtual package provided by: libnvidia-compute-565-server 565.57.01-0ubuntu0.22.04.4 libnvidia-compute-550-server 550.127.08-0ubuntu0.22.04.1 libnvidia-compute-550 550.120-0ubuntu0.22.04.1 libnvidia-compute-545 545.29.06-0ubuntu0.22.04.2 libnvidia-compute-535-server 535.216.03-0ubuntu0.22.04.1 libnvidia-compute-535 535.183.01-0ubuntu0.22.04.1 You should explicitly select one to install.

E: Package 'nvidia-opencl-icd' has no installation candidate