HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //proc/thread-self/root/usr/local/qcloud/nv/nv_cuda_install.sh
#!/bin/bash

cuda_installer=$1

nvidia_devices=$(lspci -d 10de:)
if [ "$nvidia_devices" == "" ]; then
	echo "make sure there is a nvidia pci device"
	exit -1
fi

if [ $(id -u) != 0 ]; then
	echo "must be root"
	exit -1
fi

wait_time=0
get_cuda=0
while [ $wait_time -lt 100 ]; do
	wget "http://mirrors.tencentyun.com/install/GPU/$cuda_installer" -O /tmp/$cuda_installer
	if [ $? == 0 ]; then
		get_cuda=1
		break;
	fi
	wait_time=$(($wait_time+1))
	sleep 1
done
if [ x$get_cuda != x1 ]; then
        echo "download cuda file failed, please check the input,url oand network"
        exit -1
fi

chmod u+x /tmp/$cuda_installer
/tmp/$cuda_installer --toolkit --samples --silent --override
echo "install nvidia cuda finished"
rm -f /tmp/$cuda_installer

if [ -d /usr/local/cuda-*/samples ]; then
    cd /usr/local/cuda-*/samples/1_Utilities/deviceQuery && make> /dev/null 2>&1 && ./deviceQuery > /dev/null 2>&1 || { echo "install cuda failed and exit."; exit 1;}
elif [ -d /root/NVIDIA_CUDA-*_Samples ]; then
    cd /root/NVIDIA_CUDA-*_Samples/1_Utilities/deviceQuery && make> /dev/null 2>&1 && ./deviceQuery > /dev/null 2>&1 || { echo "install cuda failed and exit."; exit 1;}
else 
    nvccpath=`find /usr/local/ -name "nvcc"` && $nvccpath --version > /dev/null 2>&1 || { echo "install cuda failed and exit."; exit 1;}
fi

# restart barad
if [ -d /usr/local/qcloud/monitor/barad/ ]; then
    if [ $(ps -ef | grep barad_agent | wc -l) -gt 1 ]; then
        /usr/local/qcloud/monitor/barad/admin/stop.sh
        /usr/local/qcloud/monitor/barad/admin/trystart.sh
        echo "barad agent restarted"
    fi
fi