笔记本 shinelon E479 (NVIDIA GM108M [GeForce 940M] rev a2 )
0. 本机环境
sudo cat /sys/class/dmi/id/board_name
# E479
sudo dmidecode -t baseboard
uname -a
#Linux SHL 6.5.0-35-generic #35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 7 09:00:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/issue
#Ubuntu 22.04.3 LTS \n \l
lspci | grep -i nvidia
#01:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 940M] (rev a2)
4. apt安装nvidia驱动 then reboot
ubuntu-drivers devices
"""
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001347sv00001B6Csd00005038bc03sc02i00
vendor : NVIDIA Corporation
model : GM108M [GeForce 940M]
driver : nvidia-driver-390 - distro non-free
driver : nvidia-driver-535 - distro non-free recommended 推荐
driver : nvidia-driver-535-server - distro non-free
driver : nvidia-driver-470 - distro non-free
driver : nvidia-driver-470-server - distro non-free
driver : nvidia-driver-418-server - distro non-free
driver : nvidia-driver-450-server - distro non-free
driver : nvidia-driver-545 - distro non-free
driver : xserver-xorg-video-nouveau - distro free builtin
"""
sudo apt-get install nvidia-driver-535
sudo reboot
重启后
内核模块中有nvidia
lsmod |grep -i nvidia
"""
nvidia_uvm 1802240 0
nvidia_drm 94208 2
nvidia_modeset 1314816 2 nvidia_drm
nvidia 56815616 82 nvidia_uvm,nvidia_modeset
drm_kms_helper 274432 3 drm_display_helper,nvidia_drm,i915
drm 765952 15 drm_kms_helper,drm_display_helper,nvidia,drm_buddy,nvidia_drm,i915,ttm
video 73728 2 i915,nvidia_modeset
"""
驱动版本
NVIDIA-SMI 535.171.04
nvidia-smi
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.171.04 Driver Version: 535.171.04 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| 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 940M Off | 00000000:01:00.0 Off | N/A |
| N/A 47C P8 N/A / 200W | 3MiB / 2048MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 979 G /usr/lib/xorg/Xorg 2MiB |
到此时 nvidia驱动已经安装完毕
sudo prime-select --help
#Usage: /usr/bin/prime-select nvidia|intel|on-demand|query
sudo prime-select query
#on-demand
此时(安装完nvida驱动后), 可以禁止Wayland(恢复x11协议)
此步骤不用做, 这台是服务器,不是工作机,因此不关心x11或wayland
cuda toolkit
assert : cuda version <= driver version
assert : cudaToolkit version cuda_12.2.2_535.104.05_linux.run <= driver version : NVIDIA-SMI 535.171.04
链接点击步骤:
wget https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda_12.2.2_535.104.05_linux.run
#sudo sh cuda_12.2.2_535.104.05_linux.run
cuda env setting:
echo 'export CUDA_HOME=/app2/nvidia_cuda_12.2.2_535.104.05_linux
export PATH=$PATH:$CUDA_HOME/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_HOME/lib64' | tee -a ~/.bashrc
source ~/.bashrc
#cat /etc/ld.so.conf
#include /etc/ld.so.conf.d/*.conf
#echo "/app2/nvidia_cuda_12.2.2_535.104.05_linux/lib64/" | sudo tee -a /etc/ld.so.conf
install cuda : skip driver install
uninstall: sudo /app2/nvidia_cuda_12.2.2_535.104.05_linux/bin/cuda-uninstaller
sh cuda_12.2.2_535.104.05_linux.run --toolkitpath=/app1/nvidia_cuda_12.2.2_535.104.05_linux --toolkit --no-drm --silent
echo $? #0
which nvcc #/app2/nvidia_cuda_12.2.2_535.104.05_linux/bin/nvcc
nvcc -V
"""
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Aug_15_22:02:13_PDT_2023
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0
"""
mechrev 2022 jiguang_z (GeForce RTX 3050 Mobile)
nvidia driver
0. 本机环境
uname -a
#Linux mchrv 6.5.0-15-generic #15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/issue
#Ubuntu 22.04.3 LTS \n \l
lspci | grep -i vga
#00:02.0 VGA compatible controller: Intel Corporation Alder Lake-P GT1 [UHD Graphics] (rev 0c)
#01:00.0 VGA compatible controller: NVIDIA Corporation GA107M [GeForce RTX 3050 Mobile] (rev a1)
1. 卸载linux自带兼容驱动nouveau
echo 'blacklist nouveau
options nouveau modeset=0' | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
sudo update-initramfs -u
lsmod |grep -i nouveau
#after reboot 不再有nouveau
2. 重启电脑
重启电脑
sudo reboot
重启电脑后,只剩下集成显卡了,而集成显卡不支持双显示器,因此插外接显示器无用。
3*. 官网下载的NVIDA-Linux*.run驱动自己说不建议使用其
4. apt安装nvidia驱动 then reboot
ubuntu-drivers devices
"""
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd000025A2sv00001D05sd00001178bc03sc00i00
vendor : NVIDIA Corporation
model : GA107M [GeForce RTX 3050 Mobile]
driver : nvidia-driver-470 - distro non-free
driver : nvidia-driver-525 - distro non-free
driver : nvidia-driver-545-open - distro non-free
driver : nvidia-driver-535-server-open - distro non-free
driver : nvidia-driver-535-server - distro non-free
driver : nvidia-driver-535 - distro non-free recommended
driver : nvidia-driver-535-open - distro non-free
driver : nvidia-driver-525-server - distro non-free
driver : nvidia-driver-525-open - distro non-free
driver : nvidia-driver-470-server - distro non-free
driver : nvidia-driver-545 - distro non-free
driver : xserver-xorg-video-nouveau - distro free builtin
"""
sudo apt-get install nvidia-driver-535
sudo reboot
内核模块中有nvidia:
lsmod |grep -i nvidia
nvidia_uvm 1777664 0
nvidia_drm 90112 8
nvidia_modeset 1314816 10 nvidia_drm
nvidia 56786944 524 nvidia_uvm,nvidia_modeset
drm_kms_helper 270336 3 drm_display_helper,nvidia_drm,i915
drm 761856 15 drm_kms_helper,drm_display_helper,nvidia,drm_buddy,nvidia_drm,i915,ttm
video 73728 3 asus_wmi,i915,nvidia_modeset
命令
nvidia-smi
的输出: (driver version :NVIDIA-SMI 535.154.05
)
Sat Feb 3 20:44:02 2024
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.154.05 Driver Version: 535.154.05 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| 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 RTX 3050 ... Off | 00000000:01:00.0 On | N/A |
| N/A 41C P0 11W / 60W | 831MiB / 4096MiB | 4% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 1159 G /usr/lib/xorg/Xorg 210MiB |
| 0 N/A N/A 1641 G /usr/bin/gnome-shell 115MiB |
| 0 N/A N/A 2017 G ...irefox/2987/usr/lib/firefox/firefox 444MiB |
| 0 N/A N/A 3995 G gnome-control-center 19MiB |
+---------------------------------------------------------------------------------------+
到此时 nvidia驱动已经安装完毕
sudo prime-select --help
#Usage: /usr/bin/prime-select nvidia|intel|on-demand|query
sudo prime-select query
on-demand
此时(安装完nvida驱动后), 可以禁止Wayland(恢复x11协议)
#去掉 '#WaylandEnable=false' 前面的井号, 即 禁止Wayland
sed -i 's/#WaylandEnable=false/WaylandEnable=false/g' /etc/gdm3/custom.conf
# 禁止Wayland 后 的样子
grep WaylandEnable /etc/gdm3/custom.conf
#此行内容为'WaylandEnable=false'
sudo systemctl restart gdbm3
如果在自带驱动nouveau的状况下,禁止Wayland后 则会外接屏幕白屏,猜测是bug( nouveau 依赖于Wayland?)
禁止Wayland ,即 用回x11 的 好处是, xdotool等基于x11协议的工具能正常使用
启用Wayland ,则 基于x11 协议的工具 xdotool等 不能正常工作
Wayland 是x11的进化 ,但Wayland不兼容x11协议, Wayland比x11更讲究安全性,但这里不需要考虑安全性。
禁止Wayland 以正常化x11协议,常常是 为了 sxhkd+xdotool (键盘替代鼠标,效率工具)
sudo prime-select nvidia
or sudo prime-select intel
ldconfig -p | grep -i cuda
:
libicudata.so.70 (libc6,x86-64) => /lib/x86_64-linux-gnu/libicudata.so.70
libicudata.so.70 (ELF) => /lib/i386-linux-gnu/libicudata.so.70
libcudadebugger.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcudadebugger.so.1
libcuda.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcuda.so.1
libcuda.so.1 (libc6) => /lib/i386-linux-gnu/libcuda.so.1
libcuda.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libcuda.so
libcuda.so (libc6) => /lib/i386-linux-gnu/libcuda.so
cuda toolkit
assert : cuda version <= driver version
assert : cudaToolkit version cuda_12.2.2_535.104.05_linux.run <= driver version : NVIDIA-SMI 535.154.05
cuda-toolkit-archive
cuda-12-2-2-download-archive
cuda-12-2-2-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=runfile_local
wget https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda_12.2.2_535.104.05_linux.run
ls -lh cuda_12.2.2_535.104.05_linux.run
#-rw-rw-r-- 4.1G 2月 3 21:15 cuda_12.2.2_535.104.05_linux.run
ls -l cuda_12.2.2_535.104.05_linux.run
# -rw-rw-r-- 4344134690 2月 3 21:15 cuda_12.2.2_535.104.05_linux.run
cuda env setting:
echo 'export CUDA_HOME=/app1/nvidia_cuda_12.2.2_535.104.05_linux
export PATH=$PATH:$CUDA_HOME/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_HOME/lib64' | tee -a ~/.bashrc
source ~/.bashrc
#cat /etc/ld.so.conf
#include /etc/ld.so.conf.d/*.conf
#echo "/app1/nvidia_cuda_12.2.2_535.104.05_linux/lib64/" | sudo tee -a /etc/ld.so.conf
install cuda : skip driver install
uninstall: sudo /app1/nvidia_cuda_12.2.2_535.104.05_linux/bin/cuda-uninstaller
sh cuda_12.2.2_535.104.05_linux.run --toolkitpath=/app1/nvidia_cuda_12.2.2_535.104.05_linux --toolkit --no-drm --silent
echo $? #0
which nvcc
: /app1/nvidia_cuda_12.2.2_535.104.05_linux/bin/nvcc
nvcc -V
:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Aug_15_22:02:13_PDT_2023
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0
install cuda : error
uninstall: sudo /app1/nvidia_cuda_12.2.2_535.104.05_linux/bin/cuda-uninstaller
sudo sh cuda_12.2.2_535.104.05_linux.run --installpath=/app1/nvidia_cuda_12.2.2_535.104.05_linux
or
sh cuda_12.2.2_535.104.05_linux.run --toolkitpath=/app1/nvidia_cuda_12.2.2_535.104.05_linux --toolkit
get error :
===========
= Summary =
===========
Driver: Not Selected
Toolkit: Installed in /app1/nvidia_cuda_12.2.2_535.104.05_linux/
Please make sure that
- PATH includes /app1/nvidia_cuda_12.2.2_535.104.05_linux/bin
- LD_LIBRARY_PATH includes /app1/nvidia_cuda_12.2.2_535.104.05_linux/lib64, or, add /app1/nvidia_cuda_12.2.2_535.104.05_linux/lib64 to /etc/ld.so.conf and run ldconfig as root
To uninstall the CUDA Toolkit, run cuda-uninstaller in /app1/nvidia_cuda_12.2.2_535.104.05_linux/bin
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 535.00 is required for CUDA 12.2 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
sudo <CudaInstaller>.run --silent --driver
Logfile is /tmp/cuda-installer.log
choose “Continue”
input “accept”
uncheck “Driver”, uncheck “535.104.05”
test cuda:
1. nvcc
nvcc -V
,
2. deviceQuery
/app1/nvidia_cuda_12.2.2_535.104.05_linux/extras/demo_suite/deviceQuery
:
/app1/nvidia_cuda_12.2.2_535.104.05_linux/extras/demo_suite/deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "NVIDIA GeForce RTX 3050 Laptop GPU"
CUDA Driver Version / Runtime Version 12.2 / 12.2
CUDA Capability Major/Minor version number: 8.6
Total amount of global memory: 3902 MBytes (4091478016 bytes)
(16) Multiprocessors, (128) CUDA Cores/MP: 2048 CUDA Cores
GPU Max Clock rate: 1500 MHz (1.50 GHz)
Memory Clock rate: 6001 Mhz
Memory Bus Width: 128-bit
L2 Cache Size: 1572864 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
Maximum Layered 1D Texture Size, (num) layers 1D=(32768), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(32768, 32768), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 65536
Warp size: 32
Maximum number of threads per multiprocessor: 1536
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 2 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): Yes
Device supports Compute Preemption: Yes
Supports Cooperative Kernel Launch: Yes
Supports MultiDevice Co-op Kernel Launch: Yes
Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 12.2, CUDA Runtime Version = 12.2, NumDevs = 1, Device0 = NVIDIA GeForce RTX 3050 Laptop GPU
Result = PASS
3. cupti_query
cd /app1/nvidia_cuda_12.2.2_535.104.05_linux/extras/CUPTI/samples/cupti_query/
make
ls
#cupti_query cupti_query.cpp cupti_query.o Makefile
file /app1/nvidia_cuda_12.2.2_535.104.05_linux/extras/CUPTI/lib64/libcupti.so.12
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/app1/nvidia_cuda_12.2.2_535.104.05_linux/extras/CUPTI/lib64/
./cupti_query
"""Assuming default device id 0
CUDA Device Id : 0
CUDA Device Name: NVIDIA GeForce RTX 3050 Laptop GPU
cupti_query.cpp:450: Error: Function cuptiDeviceEnumEventDomains(dev, &size, (CUpti_EventDomainID *)&domainId) failed with error: CUPTI_ERROR_LEGACY_PROFILER_NOT_SUPPORTED.
"""
if not add extras/CUPTI/lib64/````to LD_LIBRARY_PATH, run ``./cupti_query
get error:
./cupti_query: error while loading shared libraries: libcupti.so.12: cannot open shared object file: No such file or directory
other
if not set PATH , LD_LIBRARY_PATH then executesudo sh cuda_12.2.2_535.104.05_linux.run --installpath=/app1/nvidia_cuda_12.2.2_535.104.05_linux
get error:
===========
= Summary =
===========
Driver: Not Selected
Toolkit: Installed in /app1/nvidia_cuda_12.2.2_535.104.05_linux/
Please make sure that
- PATH includes /app1/nvidia_cuda_12.2.2_535.104.05_linux/bin
- LD_LIBRARY_PATH includes /app1/nvidia_cuda_12.2.2_535.104.05_linux/lib64, or, add /app1/nvidia_cuda_12.2.2_535.104.05_linux/lib64 to /etc/ld.so.conf and run ldconfig as root
To uninstall the CUDA Toolkit, run cuda-uninstaller in /app1/nvidia_cuda_12.2.2_535.104.05_linux/bin
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 535.00 is required for CUDA 12.2 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
sudo <CudaInstaller>.run --silent --driver
Logfile is /var/log/cuda-installer.log
sudo sh ./cuda_12.2.2_535.104.05_linux.run --help
:
Options:
--silent
Performs an installation with no further user-input and minimal
command-line output based on the options provided below. Silent
installations are useful for scripting the installation of CUDA.
Using this option implies acceptance of the EULA. If running with
non-root permissions, additional customizations may be necessary
with other command-line options.
--driver
Install the CUDA Driver.
--kernelobjects
Install the CUDA Kernel Objects.
--kopath=<path>
Install the CUDA Kernel Objects to <path>.
--toolkit
Install the CUDA Toolkit.
--toolkitpath=<path>
Install the CUDA Toolkit to the <path> directory. If this flag is not
provided, the default path of /usr/local/cuda-12.2 is used.
--installpath=<path>
Install everything to the <path> directory. This flag overrides the
--toolkitpath flag if it is set.
--extract=<path>
Extracts driver runfile and the raw files of the toolkit to <path>.
This is especially useful when one wants to install the driver using one or
more of the command-line options provided by the driver installer which
are not exposed in this installer.
--override
Ignores compiler version checks which would prevent installation.
--no-opengl-libs
Prevents the driver installation from installing NVIDIA's GL libraries.
Useful for systems where the display is driven by a non-NVIDIA GPU.
In such systems, NVIDIA's GL libraries could prevent X from loading
properly.
--no-man-page
Do not install the man pages under /usr/share/man.
--kernel-module-build-directory=<kernel|kernel-open>
Tells the driver installation to use legacy or open flavor of kernel source
when building the NVIDIA kernel module. The kernel-open flavor is only
supported on Turing GPUs and newer.
-m=kernel
Tells the driver installation to use legacy flavor of kernel source when
building the NVIDIA kernel module.
Shorthand for --kernel-module-build-directory=kernel
-m=kernel-open
Tells the driver installation to use open flavor of kernel source when
building the NVIDIA kernel module. The kernel-open flavor is only supported
on Turing GPUs and newer.
Shorthand for --kernel-module-build-directory=kernel-open
--kernel-source-path=<path>
Tells the driver installation to use <path> as the kernel source directory
when building the NVIDIA kernel module. Required for systems where the
kernel source is installed to a non-standard location.
--kernel-output-path=<path>
Tells the driver installation to use <path> as the kernel output directory
when building the NVIDIA kernel module. Required for systems where the
kernel obects are loaded from a non-standard location.
--run-nvidia-xconfig
Tells the driver installation to run nvidia-xconfig to update the system
X configuration file so that the NVIDIA X driver is used. The pre-existing
X configuration file will be backed up.
This option should not be used on systems that require a custom
X configuration, or on systems where a non-NVIDIA GPU is rendering the
display.
--no-drm
Do not install the nvidia-drm kernel module. This kernel module provides
several features, including X11 autoconfiguration, support for PRIME, and
DRM-KMS. The latter is used to support modesetting on windowing systems
that run independently of X11. The '--no-drm' option should only be used
to work around failures to build or install the nvidia-drm kernel module
on systems that do not need these features.
--tmpdir=<path>
Performs any temporary actions within <path> instead of /tmp. Useful in
cases where /tmp cannot be used (doesn't exist, is full, is mounted with
'noexec', etc.).
--help
Prints this help message.
cuDNN(cuda Deep Nueral Network?)
another ASUS (Geforce 610M)
cat /etc/issue
#Ubuntu 22.04.3 LTS \n \l
#compiled by gcc12
#wget https://cn.download.nvidia.cn/XFree86/Linux-x86_64/390.157/NVIDIA-Linux-x86_64-390.157.run
sudo apt search --names-only nvida-driver-390*
sudo apt install nvida-driver-390 #error , detail see :
sudo bash NVIDIA-Linux-x86_64-390.157.run --no-x-check #error detail:
0. 本机环境
uname -a
#Linux v 6.2.0-39-generic #40~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 16 10:53:04 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/issue
#Ubuntu 22.04.3 LTS \n \l
lspci | grep -i vga
#01:00.0 VGA compatible controller: NVIDIA Corporation GA107M [GeForce RTX 3050 Mobile] (rev a1)
1. 卸载linux自带兼容驱动nouveau
echo 'blacklist nouveau
options nouveau modeset=0' | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
sudo update-initramfs -u
lsmod |grep -i nouveau
#after reboot 不再有nouveau
2. 重启电脑
重启电脑
sudo reboot
重启电脑后,只剩下集成显卡了,而集成显卡不支持双显示器,因此插外接显示器无用。
3*. 官网下载的NVIDA-Linux*.run驱动自己说不建议使用其
cd ~/Downloads/
sudo chmod +x ./NVIDIA-Linux-x86_64-535.146.02.run
sudo ./NVIDIA-Linux-x86_64-535.146.02.run
#他会提示说 由于本系统 ubuntu 有做好的驱动 (指 apt安装 ),不建议用本 .run文件
# 若遇到错误: You appear to be running an X server; please exit X before installing. For further details, please see the section INSTALLING THE NVIDIA DRIVER in the README available on the Linux driver download page at www.nvidia.com.
# 增加 --no-x-check 选项
sudo ./NVIDIA-Linux-x86_64-535.146.02.run --no-x-check
这里 选择 卸载 .run 的安装内容,并用apt安装
#获得帮助
./NVIDIA-Linux-x86_64-535.146.02.run --help
#获得更多帮助
./NVIDIA-Linux-x86_64-535.146.02.run -A | grep -i uninstall
#卸载 .run 的安装内容
./NVIDIA-Linux-x86_64-535.146.02.run --uninstall
4. apt安装nvidia驱动
支持GeForce RTX 3050 Mobile的驱动版本
ubuntu22已经有nvidia-driver , 因此不需要
添加额外仓库sudo add-apt-repository ppa:graphics-drivers/ppa ; sudo apt update
sudo apt search --names-only nvidia-driver-53*
#确实能搜索到535版本
sudo apt install nvidia-driver-535
内核模块中有nvidia:
lsmod |grep -i nvidia
nvidia_uvm 1765376 0
nvidia_drm 90112 4
nvidia_modeset 1314816 3 nvidia_drm
nvidia 56741888 114 nvidia_uvm,nvidia_modeset
drm_kms_helper 249856 3 drm_display_helper,nvidia_drm,i915
drm 700416 18 drm_kms_helper,drm_display_helper,nvidia,drm_buddy,nvidia_drm,i915,ttm
video 73728 3 asus_wmi,i915,nvidia_modeset
命令
nvidia-smi
的输出:
Mon Dec 25 17:04:21 2023
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.129.03 Driver Version: 535.129.03 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| 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 RTX 3050 ... Off | 00000000:01:00.0 On | N/A |
| N/A 41C P8 5W / 60W | 57MiB / 4096MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 1527 G /usr/lib/xorg/Xorg 53MiB |
+---------------------------------------------------------------------------------------+
5. ubuntu22下 Cytoscape3.10能正常使用但启动时报错找不到libOpenCL.so
Cytoscape3.10 所用jdk17环境如下:
env | grep -i java
#JAVA_HOME=/jdk17
which javac && which java
#/jdk17/bin/javac
#/jdk17/bin/java
readlink -f `which javac` && readlink -f `which java`
#/app/zulu17.46.19-ca-jdk17.0.9-linux_x64/bin/javac
#/app/zulu17.46.19-ca-jdk17.0.9-linux_x64/bin/java
Cytoscape3.10启动
/app/cytoscape-unix-3.10.1/cytoscape.sh
后能正常使用,但控制台有如下报错:
karaf@Cytoscape 3.10.1()> [LWJGL] Failed to load a library. Possible solutions:
a) Install the library or the driver that provides the library.
b) Ensure that the library is accessible from the system library paths.
[LWJGL] Enable debug mode with -Dorg.lwjgl.util.Debug=true for better diagnostics.
[LWJGL] Enable the SharedLibraryLoader debug mode with -Dorg.lwjgl.util.DebugLoader=true for better diagnostics.
java.lang.UnsatisfiedLinkError: Failed to locate library: libOpenCL.so
at org.lwjgl.system.Library.loadNative(Library.java:346)
at org.lwjgl.system.Library.loadNative(Library.java:236)
at org.lwjgl.system.Library.loadNative(Library.java:217)
at org.lwjgl.system.Library.loadNative(Library.java:431)
at org.lwjgl.system.Library.loadNative(Library.java:402)
at org.lwjgl.opencl.CL.create(CL.java:57)
at org.lwjgl.opencl.CL.<clinit>(CL.java:45)
at org.cytoscape.cycl.internal.CyCL.initialize(CyCL.java:54)
at org.cytoscape.cycl.internal.CyActivator.lambda$start$0(CyActivator.java:32)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
No devices found
实际上有opencl库,
ldconfig -p | grep -i opencl
:
libnvidia-opencl.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libnvidia-opencl.so.1
libnvidia-opencl.so.1 (libc6) => /lib/i386-linux-gnu/libnvidia-opencl.so.1
libOpenCL.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libOpenCL.so.1
解决办法是 :
- 按照以上1到4步骤 安装好 nvidia驱动
- 软链接 opencl.so路径 :
sudo ln -s /lib/x86_64-linux-gnu/libOpenCL.so.1.0.0 /lib/x86_64-linux-gnu/libOpenCL.so
Cytoscape3.10启动
/app/cytoscape-unix-3.10.1/cytoscape.sh
后(不再报错)说找到nvidia显卡设备了
karaf.base: /app/cytoscape-unix-3.10.1/framework
JAVA_HOME: /jdk17
_
___ _ _| |_ ___ ___ ___ __ _ _ __ ___
/ __| | | | __|/ _ \/ __|/ __|/ _` | '_ \ / _ \
| (__| |_| | |_| (_) \__ \ (__| (_| | |_) | __/
\___|\__, |\__|\___/|___/\___|\__,_| .__/ \___|
|___/ |_|
Cytoscape 3.10.1
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown Cytoscape.
karaf@Cytoscape 3.10.1()> Found 1 platforms #找到1平台
Got 1 platforms
Got 1 devices
Platform: NVIDIA CUDA
Device: OpenCL 3.0 CUDA NVIDIA GeForce RTX 3050 Laptop GPU #即 找到了 nvidia显卡
The cl_program [0x7F4B88B75B60] was built successfully
BUILD LOG:
----
-----
Program built
Top device after init = OpenCL 3.0 CUDA NVIDIA GeForce RTX 3050 Laptop GPU
UserAgent = Cytoscape v3.10.1 Java 17.0.9 Linux 6.2.0-39-generic
latestVersion = 3.10.1
6. cytoscape3.10教程
6.1 Cytoscape界面操作
- 导入 起点_终点_边字段们,边字段们 是可选的,起点、终点 都是节点,
- 导入属性字段, 属性 即 节点的属性
- 根据某属性字段的值调整节点颜色,该属性字段是枚举 即 离散, 视频中枚举字段名是type字段
- 根据某属性字段的值调整节点尺寸,该属性字段是连续的,视频中的连续字段名是Genenum
- 根据某边字段的值调整边的颜色,该字段是边字段,视频中的字段名是PCC
6.2 Cytoscape脚本
Cytoscape脚本,
脚本例子New_wrapper_api_sample.ipynb
脚本例子目录 py2cytoscape/examples/