Ubuntu安装gpu驱动,cuda

系统初始化

1、安装基础软件

apt-get update
apt-get -y install openssh-server openssh-client apt-utils freeipmi ipmitool sshpass  ethtool zip unzip nano less git netplan.io iputils-ping mtr ipvsadm smartmontools python3-pip socat conntrack libvirt-clients libnuma-dev ctorrent nvme-cli
apt-get -y install vim wget apt git unzip zip ntp ntpdate lrzsz lftp tree bash-completion  elinks dos2unix tmux jq
apt-get -y install  nmap net-tools  mtr traceroute tcptraceroute aptitude htop iftop hping3 fping nethogs sshuttle tcpdump figlet  stress iperf iperf3 dnsutils curlcurl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
git lfs install

2,调整文件描述符

echo "ulimit -SHn 655350" >>/etc/profile
echo "fs.file-max = 655350" >>/etc/sysctl.conf
echo "root soft nofile 655350" >>/etc/security/limits.conf
echo "root hard nofile 655350" >>/etc/security/limits.conf
echo "* soft nofile 655350" >>/etc/security/limits.conf
echo "* hard nofile 655350" >>/etc/security/limits.conf
echo "session required pam_limits.so" >>/etc/pam.d/common-session
source /etc/profile

3,优化history

cat /etc/profile
export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S  `whoami` "
export HISTFILESIZE=50000
export HISTSIZE=50000
source /etc/profile

4,检查防火墙和设置journalctl日志大小避免把系统盘占满

apt list --installed | grep ufw
如果ufw默认安装则需要关闭
ufw disablejournalctl 命令自动维护文件大小
只保留近一周的日志
journalctl --vacuum-time=1w只保留500MB的日志
journalctl --vacuum-size=500M

5,优化内核参数

cp /etc/sysctl.conf /etc/sysctl.conf.bakvi /etc/sysctl.conf
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_abort_on_overflow = 1
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rmem = 4096        87380  4194304
net.ipv4.tcp_wmem = 4096        66384  4194304
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.core.optmem_max = 81920
net.core.wmem_default = 8388608
net.core.wmem_max = 16777216
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.ipv4.tcp_max_syn_backlog = 1020000
net.core.netdev_max_backlog = 862144
net.core.somaxconn = 262144
net.ipv4.tcp_max_orphans = 327680
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_keepalive_time = 30
net.ipv4.ip_local_port_range = 1024    65535
net.netfilter.nf_conntrack_tcp_timeout_established = 180
net.netfilter.nf_conntrack_max = 1048576
net.nf_conntrack_max = 1048576
fs.file-max = 655350
modprobe nf_conntrack
sysctl -p /etc/sysctl.conf
sysctl -w net.ipv4.route.flush=1

关闭ubuntu更新

rm -rf /etc/apt/apt.conf.d/20auto-upgrades
cat << EOF > /etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Download-Upgradeable-Packages "0";
APT::Periodic::AutocleanInterval "0";
APT::Periodic::Unattended-Upgrade "0";
EOFsed -i "/^Unattended-Upgrade::Allowed-Origins {/,/^};/s/^/\/\//" /etc/apt/apt.conf.d/50unattended-upgrades
systemctl restart unattended-upgrades
systemctl status unattended-upgradesmv /etc/update-motd.d /etc/update-motd.d.backup
mkdir -p /etc/update-motd.d

7,关闭swap

swapoff -a
删除 /etc/fstab内swap的行systemctl list-unit-files|grep swap
systemctl disable dev-nvme0n1p2.swap
systemctl status dev-nvme0n1p2.swapsystemctl status swap.target
systemctl stop swap.target//防止 systemd-gpt-auto-generator 在启动时自动激活 Swap。需要在 /etc/fstab 中添加一个 noauto 选项的 swap 行
cat /etc/fstab
/dev/nvme0n1p2 none swap noauto

8、开启root 用户ssh并优化ssh

sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/#ClientAliveInterval 0/ClientAliveInterval 15/g' /etc/ssh/sshd_config
sed -i 's/#ClientAliveCountMax 3/ClientAliveCountMax 30/g' /etc/ssh/sshd_config
systemctl enable ssh.service
systemctl restart sshd

9、配置时区并同步时间

timedatectl set-timezone Asia/Shanghaintpdate ntp1.aliyun.com
systemctl restart ntp
systemctl enable ntp

10、配置pip源

mkdir -p /root/.pip
cat /root/.pip/pip.conf
[global]
timeout = 60
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.compip3 install virtualenv

11、配置静态IP地址

root@duanshuaixing:~# cat /etc/netplan/01-network-manager-all.yaml
## Let NetworkManager manage all devices on this system
#network:
#  version: 2
#  renderer: NetworkManager
## Let NetworkManager manage all devices on this system
network:ethernets:wlp0s20f3:   # 配置的网卡的名称addresses: [192.168.31.45/24]   # 配置的静态ip地址和掩码dhcp4: false   # 关闭dhcp4optional: trueroutes:- to: defaultvia: 192.168.31.1/24nameservers:addresses: [192.168.31.1,114.114.114.114]  # DNS服务器地址,多个DNS服务器地址需要用英文逗号分>隔开,可不配置version: 2renderer: NetworkManagerroot@duanshuaixing:~# sudo netplan apply

安装nvidia驱动

安装基础软件

apt-get -y install openssh-server openssh-client apt-utils freeipmi ipmitool sshpass  ethtool zip unzip nano less git netplan.io iputils-ping mtr ipvsadm smartmontools python3-pip socat conntrack libvirt-clients libnuma-dev ctorrent nvme-cli
apt-get -y install vim wget apt git unzip zip ntp ntpdate lrzsz lftp tree bash-completion  elinks dos2unix tmux jq
apt-get -y install  nmap net-tools  mtr traceroute tcptraceroute aptitude htop iftop hping3 fping nethogs sshuttle tcpdump figlet  stress iperf iperf3 dnsutils curl
apt install build-essential dkms linux-headers-$(uname -r)安装git-lfs
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
git lfs install

禁用ubuntu自带的nouveau驱动

cat << EOF >  /etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
EOF

执行以下命令关闭nouveau

echo options nouveau modeset=0 | tee -a /etc/modprobe.d/nouveau-kms.conf
update-initramfs -u
执行行完上述两条命令后必须重启系统
重启后执行   lsmod | grep nouveau
没有回显表示关闭成功。

安装nvidia驱动(https://download.nvidia.com/XFree86/Linux-x86_64)

获取推荐安装版本
add-apt-repository ppa:graphics-drivers/ppa
apt-get update
ubuntu-drivers devices
显示推荐版本(recommended那项)wget https://download.nvidia.com/XFree86/Linux-x86_64/575.57.08/NVIDIA-Linux-x86_64-575.57.08.run
chmod a+x NVIDIA-Linux-x86_64-575.57.08.run 
bash NVIDIA-Linux-x86_64-575.57.08.run 
执行nvidia-smi 显示下图表示安装成功

在这里插入图片描述

安装cuda

根据上面步骤可以看到cuda支持最新可用的cuda版本是12.9,登录访问https://developer.nvidia.com/cuda-toolkit-archive 并下载12.9版本的cuda
在这里插入图片描述

wget https://developer.download.nvidia.com/compute/cuda/12.9.0/local_installers/cuda_12.9.0_575.51.03_linux.run
chmoad a+x cuda_12.9.0_575.51.03_linux.run
bash cuda_12.9.0_575.51.03_linux.run选择continue->accept-->取消Driver安装-->Install在pofile内添加cuda环境变量
cat /etc/profile
export PATH=$PATH:/usr/local/cuda/bin  
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64  
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda/lib64source /etc/profile
nvcc -V 验证

在这里插入图片描述

安装docker

wget https://download.docker.com/linux/static/stable/x86_64/docker-28.3.0.tgztar xf docker-28.3.0.tgz
cp docker/* /usr/bin/
vi /etc/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd --selinux-enabled=false 
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.targetchmod 777 /etc/systemd/system/docker.service
systemctl daemon-reload && systemctl enable docker.service
systemctl restart docker
docker info
mkdir -p /etc/dockervi /etc/docker/daemon.json
{"registry-mirrors": ["https://t3xbrfwz.mirror.aliyuncs.com","https://docker.unsee.tech","https://dockerpull.org","https://docker.1panel.live","https://dockerhub.icu","https://docker.m.daocloud.io","https://docker.nju.edu.cn"],"exec-opts": ["native.cgroupdriver=systemd"],"log-driver": "json-file","log-opts": {"max-size": "100m"},"max-concurrent-downloads": 30,"max-concurrent-uploads": 15,"live-restore": true
}

安装nvidiaDocker

使用中科大镜像源安装 NVIDIA Container Toolkit
1. 下载 GPG 密钥并保存
curl -fsSL https://mirrors.ustc.edu.cn/libnvidia-container/gpgkey | \sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
2. 配置 APT 源列表curl -s -L https://mirrors.ustc.edu.cn/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \sed 's#deb https://nvidia.github.io#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://mirrors.ustc.edu.cn#g' | \sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
3. 更新包列表并安装
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
4. 验证安装
nvidia-container-cli --versiondocker-nvidia json加速配置
cat /etc/docker/daemon.json
{"runtimes": {"nvidia": { "path": "/usr/bin/nvidia-container-runtime","runtimeArgs": []}}
}

在这里插入图片描述

GPU优化

1.固定软件版本

#固定nvidia相关包的版本
dpkg -l | awk '{print $2}' | grep -E '^nvidia-'|xargs -n 1 apt-mark hold
#固化系统内核版本
dpkg -l | awk '{print $2}' | grep -E '^linux-'|xargs -n 1 apt-mark holddpkg-query -W --showformat='${Package} ${Status}\n' | \
grep -v deinstall | \
awk '{ print $1 }' | \
grep -E 'nvidia.*-[0-9]+$' | \
xargs -r -L 1 sudo apt-mark hold

2,开启Persistence Mode模式

作用:将 NVIDIA GPU 卡的 Persistence Mode 设置为 enable 状态。Persistence mode 被设计为在 GPU 长时间无活动时,把 GPU 驱动保持在活动状态。开启这个模式可以提高例如 CUDA 内核的启动时间,因为不需要在每次执行 CUDA 应用时再去唤醒 GPU。

命令:
nvidia-smi -pm ENABLED
或者
nvidia-smi -pm 1

3、允许ECC内存模式下模拟错误

作用:允许 GPU 在 ECC(Error Correction Code)内存模式下模拟错误。但是请注意,这个选项只在某些特定型号的 Tesla 和 Quadro 设备上有效
命令:
nvidia-smi -e ENABLED

4、CPU锁频

# 锁定CPU频率可提升性能,部分机型可能会设置失败先忽略其报错
sudo apt-get -y  install linux-tools-5.15.0-67-generic linux-cloud-tools-5.15.0-67-generic
cpupower idle-set -D 0 || true
cpupower -c all frequency-set -g performance || true
————————————————

5、GPU锁频

# 锁定GPU频率1410
nvidia-smi -lgc 1410 || true

6、PCI设备中查支持ACS设备并关闭ACS

遍历系统中的所有PCI设备,并尝试禁用那些支持ACS功能的设备的ACS特性。禁用ACS通常是为了避免在多GPU系统中可能出现的带宽限制问题,确保所有GPU间能更有效地共享总线资源

lspci -vvv | grep "PCI bridge" | cut -d" " -f 1 | xargs -I{} setpci -s {} ECAP_ACS+06.w=0000

7、cpu性能模式

cpupower frequency-set -g performance
cpupower idle-set -D 0

8,安装nvidia-fabricmanager(必须和驱动版本保持一致),非必需需要有NVSwitch硬件支持

1.查看驱动版本

root@ubuntu:~# nvidia-smi|grep 'Driver Version'
| NVIDIA-SMI 575.57.08              Driver Version: 575.57.08      CUDA Version: 12.9     |

2.下载安装

wget https://developer.download.nvidia.cn/compute/cuda/repos/ubuntu2204/x86_64/nvidia-fabricmanager-575_575.57.08-1_amd64.deb
dpkg -i nvidia-fabricmanager-575_575.57.08-1_amd64.debsystemctl enable nvidia-fabricmanager.service
systemctl restart nvidia-fabricmanager.service
systemctl status nvidia-fabricmanager.service

9、启用 GPU P2P 功能

echo "nvidia_peermem" >>/etc/modules-load.d/nvidia.conf
modprobe nvidia_peermem && lsmod | grep nvidia_peermem
nvidia-smi nvlink --status

10、部署HPC-X(https://developer.nvidia.com/networking/hpc-x 页面最下选择下载版本

apt-get -y install lbzip2
wget https://content.mellanox.com/hpc/hpc-x/v2.18/hpcx-v2.18-gcc-mlnx_ofed-ubuntu20.04-cuda12-x86_64.tbz
tar -xf hpcx-v2.18-gcc-mlnx_ofed-ubuntu20.04-cuda12-x86_64.tbz -C /opt/
ln -s /opt/hpcx-v2.18-gcc-mlnx_ofed-ubuntu20.04-cuda12-x86_64 /opt/hpcxubuntu2204用这个
wget https://content.mellanox.com/hpc/hpc-x/v2.18/hpcx-v2.18-gcc-mlnx_ofed-ubuntu22.04-cuda12-x86_64.tbztar -xf hpcx-v2.18-gcc-mlnx_ofed-ubuntu22.04-cuda12-x86_64.tbz -C /opt/ln -s /opt/hpcx-v2.18-gcc-mlnx_ofed-ubuntu22.04-cuda12-x86_64 /opt/hpcx#激活hpc-x
export HPCX_HOME=/opt/hpcx
. $HPCX_HOME/hpcx-init.sh
hpcx_load

11、安装nccl(静态编译)

mkdir -p /root/nccl/ && cd /root/nccl
git clone https://github.com/NVIDIA/nccl.git
cd nccl
make src.build CUDA_HOME=/usr/local/cuda PATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

12,安装nccl-test(静态编译)

mkdir -p /root/nccl/ && cd /root/nccl
git clone https://github.com/NVIDIA/nccl-tests.git
cd nccl-tests
which mpirun
# /opt/hpcx/ompi/bin/mpirun 截取 MPI_HOME=/opt/hpcx/ompiPATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64 LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda/lib64 make -j 8 CUDA_HOME=/usr/local/cuda NCCL_HOME=/root/nccl/nccl/build NCCL_LIBDIR=/root/nccl/nccl/build/lib NCCL_STATIC=1以MPI方式构建
PATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64 LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda/lib64 make -j 32  MPI=1  MPI_HOME=/opt/hpcx/ompi CUDA_HOME=/usr/local/cuda NCCL_HOME=/root/nccl/nccl/build NCCL_LIBDIR=/root/nccl/nccl/build/lib NCCL_STATIC=1多机MPI方式运行, 在hostfile内添加对应文件,并且在同一个目录存放nccl、nccl-test、mpi这些文件,需要多机保持一致
mpirun --allow-run-as-root --hostfile /root/hostfile -oversubscribe -map-by ppr:8:node -mca pml ob1 -mca btl ^openib -x OMPI_MCA_btl_tcp_if_include="eth0" -x NCCL_NET_GDR_LEVEL=4 -x NCCL_PXN_DISABLE=1 -x NCCL_IB_GID_INDEX=3 -x NCCL_NVLS_ENABLE=1 -x LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/nccl/nccl/build/lib -x NCCL_DEBUG=VERSION /root/nccl/nccl-tests/build/all_reduce_perf -b 128M -e 8G -g 1 -f 2 -i 0cat /root/hostfile #要求node01和node02免密ssh,包括ssh 自己
node01 slots=8
node02 slots=8

13,测试

 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/nccl/nccl/build/lib./build/all_reduce_perf -b 8 -e 128M -f 2 -g 1#以MPI方式执行
mpirun --allow-run-as-root --host localhost -oversubscribe -map-by ppr:8:node -mca pml ob1 -mca btl ^openib -x OMPI_MCA_btl_tcp_if_include="eth0" -x NCCL_NET_GDR_LEVEL=4 -x NCCL_PXN_DISABLE=1 -x NCCL_IB_GID_INDEX=3 -x NCCL_NVLS_ENABLE=1 -x NCCL_DEBUG=INFO /root/nccl/nccl-tests/build/all_reduce_perf -b 4G -e 4G -g 1 -f 2 -i 0mpirun --allow-run-as-root --host localhost -oversubscribe -map-by ppr:8:node -mca pml ob1 -mca btl ^openib -x OMPI_MCA_btl_tcp_if_include="eth0" -x NCCL_NET_GDR_LEVEL=4 -x NCCL_PXN_DISABLE=1 -x NCCL_IB_GID_INDEX=3 -x NCCL_NVLS_ENABLE=1 /root/nccl/nccl-tests/build/reduce_scatter_perf -b 4G -e 4G -g 1 -f 2 -i 0

在这里插入图片描述以MPI方式测试

#查找libnccl.so.2位置
find / -name "libnccl.so.2" 2>/dev/nullexport LD_LIBRARY_PATH=/root/backup/nccl/nccl/build/lib:$LD_LIBRARY_PATH#运行测试用例
mpirun --allow-run-as-root --host 192.168.31.139 -np 1 --mca btl_tcp_if_include wlp0s20f3 --mca oob_tcp_if_include wlp0s20f3 -x NCCL_IB_GID_INDEX=3 -x NCCL_DEBUG=INFO -x NCCL_DEBUG_SUBSYS=INIT,NET,GRAPH  -x LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH -x NCCL_PXN_DISABL=0   -x NCCL_NET_PLUGIN=none /root/backup/nccl/nccl-tests/build/alltoall_perf -b 256 -e 4G -g 1 -i 104857600这个输出信息表示NCCL alltoall_perf 测试用例已经成功运行。开始的部分是 NCCL 初始化过程的调试信息,最后的部分表示执行结果。本次性能测试主要进行了浮点数的各种具有不同大小的全交换(alltoall)操作,首先进行了一个 out-of-place 操作,然后进行了一个 in-place 操作。下面是这些输出结果的一些解释:size:数据包的字节大小;
count:需要进行传输的元素数;
type:数据类型,这里都是 float;
redop:归约运算类型,这里都是 'none' 表示无归约运算;
root:归约运算的根节点,这里都是 '-1' 表示无对应的根节点;
time:操作完成的时间,单位是微秒;
algbw:“算法带宽”,即传输数据的带宽;
busbw:跨 GPU 或者跨节点间接口数据传输带宽;
#wrong:错误数,0 表示没有错误。
从这里可以看出,所有的全交换测试都成功完成,没有任何错误,并且测试的带宽值可以被算出来。输出的最后几行表明,所有的测试参数都未超出预期范围,总的平均带宽是 0(这个应该会在测试多个节点时有其他值,单节点测试为0),且整个测试流程结束后已经清理完所有资源。

all_reduce_perf测试

mpirun --allow-run-as-root --host 192.168.31.139  -np 1 -oversubscribe -map-by ppr:8:node -mca pml ob1 -mca btl ^openib -x OMPI_MCA_btl_tcp_if_include="wlp0s20f3" -x NCCL_IB_GID_INDEX=3 -x NCCL_ALGO=RING -x NCCL_COLLNET_ENABLE=0 -x LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH /root/backup/nccl/nccl-tests//build/all_reduce_perf -b 1G -e 2G -g 1 -f 2 -i 0
以下是上述测试命令的具体解释:1. `mpirun`:这是一个用于在分布式系统上启动 MPI 程序的命令。
2. `--allow-run-as-root`:这个选项允许作为 root 用户运行 mpi 程序。
3. `--host 192.168.31.45 -np 1`:这表示在 IP 地址为 192.168.31.45 的节点上启动 1 个进程。
4. `-oversubscribe`:允许在一个进程上运行的 MPI 进程数超过内核数。
5. `-map-by ppr:8:node`:设置每个节点上进程的分布模式。这里表示,每个节点上有 8 个进程进行循环放置。
6. `-mca pml ob1 -mca btl ^openib`:选择 MPI 的通信模式和传输层。这里表示,使用 `ob1` 这种点对点的通信模式,使用除了 'openib' 以外的所有可用传输层协议。
7. `-x OMPI_MCA_btl_tcp_if_include="eth0" -x NCCL_IB_GID_INDEX=3`:指定运行环境变量。这里表示,MPI 通信使用 'eth0' 这个网络接口,并将 InfiniBand 的 GID 索引设置为 38. `-x NCCL_ALGO=RING -x NCCL_COLLNET_ENABLE=0`:指定 NCCL 的环境变量。这里表示,使用 'RING' 这种算法,并关闭 Collective 跨网络功能。
9. `-x LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH`:添加运行库的搜索路径。
10. `/root/backup/nccl/nccl-tests//build/all_reduce_perf -b 1G -e 2G -g 1 -f 2 -i 0`:运行的 NCCL 性能测试和参数。输出结果中,先记录了基本参数信息,然后记录了 NCCL 使用的设备信息。接下来,程序提示最大字节数由于内存限制被自动减小到 1708916736。然后是性能测试结果,表明了 out-of-place 和 in-place 测试在 1GB 数据包下的性能表现。在这次测试结束后,没有任何错误提示,不过由于迭代次数 `-i` 参数设为了0,因此这个测试实际上没有进行任何数据传输,只是进行了创建连接和相应的资源准备。总的来说,这次的 NCCL 性能测试在设备的硬件和配置条件下运行正常,没有出现任何错误。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/news/917326.shtml
繁体地址,请注明出处:http://hk.pswp.cn/news/917326.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

ctfshow_源码压缩包泄露

根据题目信息直接dirsearch解压下来一个.txt文件&#xff0c;一个index.phpflag{flag_here}不对那么就去看index.php也没有东西&#xff0c;于是查看wp发现是访问/fl000g.txt这才是对的还有很多源码泄露需要去了解• git源码泄露• svn源码泄露• DS_Store 文件泄露• 网站备份…

Python 程序设计讲义(54):Python 的函数——函数概述

Python 程序设计讲义&#xff08;54&#xff09;&#xff1a;Python 的函数——函数概述 目录Python 程序设计讲义&#xff08;54&#xff09;&#xff1a;Python 的函数——函数概述一、函数的类型1、内置函数2、自定义函数二、调用函数Python 提供了函数机制&#xff0c;把实…

学习Python中Selenium模块的基本用法(3:下载浏览器驱动续)

前一篇文章主要介绍下载针对火狐浏览器的WebDriver&#xff0c;写那篇文章时才找到能够下最新版本Chrome的WebDriver地址&#xff08;参考文献6&#xff09;&#xff0c;本文继续学习并验证针对Chrome浏览器的WebDriver下载和使用方法。Chrome的WebDriver版本与操作系统相关&am…

AIDL当Parcelable序列化的数据类通信时报“Class not found when unmarshalling“找不到该类时的解决方案

1. 报错栈 &#xff1a;cusText这个类找不到 2 16:01:29.796 1044 5718 E Parcel : Class not found when unmarshalling: com.cus.sdk.cusText 08-02 16:01:29.796 1044 5718 E Parcel : java.lang.ClassNotFoundException: com.cus.sdk.cusText 08-02 16:01:29.796 1…

Django模型查询与性能调优:告别N+1问题

文章目录一、查询基础QuerySet 详解一对多关联查询多对多关联查询二、N1查询问题问题分析检测方法解决方案三、高级查询优化values()values_list()values()和values_list()对比Q() 对象复杂查询查看生成的 SQL四、项目实战场景实战一、查询基础 QuerySet 详解 Django 中通过模…

PyTorch 中 Tensor 统计学函数及相关概念

文章目录PyTorch 中 Tensor 统计学函数及相关概念一、引言二、基础统计学函数&#xff08;一&#xff09;torch.mean()——均值计算&#xff08;二&#xff09;torch.sum()——总和计算&#xff08;三&#xff09;torch.prod()——元素积计算&#xff08;四&#xff09;torch.m…

浅拷贝与深拷贝的区别

浅拷贝和深拷贝是两种不同的对象复制方式&#xff0c;主要区别在于它们如何处理对象内部的引用类型字段。浅拷贝 (Shallow Copy)特点&#xff1a;只复制对象本身&#xff08;基本类型字段&#xff09;和对象中的引用&#xff08;地址&#xff09;不复制引用指向的实际对象原始对…

脚本统计MongoDB集合表数据量

脚本&#xff1a; #!/bin/bashipxxx.xx.xx.xx portxxxx dbxxxdb #user #passwmongo -host ${ip}:${port} <<EOF 2>/dev/null|grep -vE version|not match|session|compressors||Warning|delivers|upcoming|installation|https|switched|bye >collec use ${db}; sho…

图漾AGV行业常用相机使用文档

文章目录1.图漾相机设置IP1.1 前期准备2.FM851-E2相机2.1 FM851-E2适用场景2.2 FM851-E2 IO线和数据线定义2.2.1 IO接口定义2.2.2 数据接口线2.2.3 相机正面安装方向2.2.4 相机IO指示灯2.3 FM851-E2/FM855-E2-7相机RGB颜色异常【解决措施1】&#xff1a;【解决措施2】&#xff…

电力系统分析学习笔记(二)- 标幺值计算与变压器建模

电力系统分析学习笔记&#xff08;二&#xff09;- 标幺值计算与变压器建模 1. 电力系统参数计算的基本原理 1.1 基本级的概念与选择 基本级定义&#xff1a; 在多电压等级的电力系统中&#xff0c;需要将所有参数归算到同一个电压等级这个统一的电压等级称为基本级 基本级选择…

防火墙相关技术内容

防火墙的状态检测和会话技术一、防火墙的检测机制早期包过滤防火墙采用逐包检测机制&#xff0c;对每个报文独立检测其源地址、目的地址、端口等信息&#xff0c;根据预设规则决定转发或丢弃。安全隐患&#xff1a;仅基于单包信息判断&#xff0c;无法识别连接状态。例如&#…

在 Mac 上用 Vagrant 安装 K8s

文章目录&#x1f4cb; 1. 环境准备1.1 系统要求1.2 软件清单&#x1f680; 2. 安装步骤2.1 安装Parallels Desktop2.2 配置网络代理&#xff08;可选&#xff09;2.3 安装Homebrew2,4 准备项目目录2.5 安装Vagrant及插件2.6 配置Python环境2.6.1 安装Python管理工具2.6.2 配置…

【AI学习】RadioDiff:代码学习

之前学习了RadioDiff这篇论文&#xff0c;最近在复刻相关代码。 这段代码实现了一个基于潜在扩散模型&#xff08;Latent Diffusion Model, LDM&#xff09;的训练框架。借助DeepSeek总体学习一下&#xff1a; 1. 整体结构 代码主要分为以下几个部分&#xff1a; 参数解析和…

【专题十七】多源 BFS

&#x1f4dd;前言说明&#xff1a; 本专栏主要记录本人的基础算法学习以及LeetCode刷题记录&#xff0c;按专题划分每题主要记录&#xff1a;&#xff08;1&#xff09;本人解法 本人屎山代码&#xff1b;&#xff08;2&#xff09;优质解法 优质代码&#xff1b;&#xff…

京东零售在智能供应链领域的前沿探索与技术实践

近日&#xff0c;“智汇运河 智算未来”2025人工智能创新创业大会在杭州召开。香港工程科学院院士、香港大学副校长、研究生院院长、讲座教授、京东零售供应链首席科学家申作军教授与供应链算法团队技术总监戚永志博士受邀出席并担任《AI智慧物流与供应链分享会》联席主席&…

MyBatisPlus之CRUD接口(IService与BaseMapper)

MyBatisPlus之CRUD接口—IService与BaseMapper一、BaseMapper与IService的关系二、BaseMapper核心方法详解2.1 新增操作&#xff08;Insert&#xff09;2.2 查询操作&#xff08;Select&#xff09;2.3 更新操作&#xff08;Update&#xff09;2.4 删除操作&#xff08;Delete&…

axios请求的取消

axios请求的取消解决&#xff1a;axios请求的取消解决&#xff1a;axios请求的取消 在使用 Axios 发起请求时&#xff0c;有时候你可能需要取消这些请求&#xff0c;比如当组件销毁时或者用户操作导致不再需要获取之前发起的请求结果。Axios 支持通过 Cancel Token 取消请求。 …

深入理解C++中的Lazy Evaluation:延迟计算的艺术

在编程世界里&#xff0c;“最好的运算就是从未执行的运算” —— 这句话深刻揭示了性能优化的核心思路。如果一个计算过程最终不会被使用&#xff0c;那么提前执行它就是纯粹的资源浪费。这种思想衍生出了 Lazy Evaluation&#xff08;缓式评估&#xff09; 技术&#xff1a;延…

php完整处理word中表单数据的方法

使用php基础方式实现word中表单处理<?php/*** zipFile 类用于处理 .docx 文件的解压、修改和重新打包*/ class zipFile {/** var ZipArchive ZIP 文件对象 */private $zipFile;/** var string 临时目录路径 */private $tempDir;/** var string 嵌入的 Excel 文件临时目录路…

Node.js 操作 MongoDB

目录 Node.js 操作 MongoDB 一、什么是 MongoDB&#xff1f; 二、MongoDB 的功能概览 三、MongoDB 的安装与启动 安装 MongoDB&#xff08;以本地安装为例&#xff09; 启动 MongoDB 四、Node.js 如何连接 MongoDB&#xff1f; 使用 Mongoose ODM 工具 建立连接 五、…