From 4cd09db8a0d41405f893e9e677f8faaab5831e0f Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 17 Mar 2022 16:03:07 +0100 Subject: [PATCH] some fixes --- README.md | 2 +- setup_apps.sh | 4 ++-- setup_bcache.sh | 26 +++++++++++++------------- setup_cuda.sh | 26 +++++++++++++------------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index b97ca3a..ed720fb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Setup for setup Tensorflow with GPU +# Setup for Tensorflow with GPU Tested for ubuntu-20.04.4 diff --git a/setup_apps.sh b/setup_apps.sh index 72cd2d6..e39f83b 100644 --- a/setup_apps.sh +++ b/setup_apps.sh @@ -14,7 +14,7 @@ if [ ! -s "~/.ssh/authorized_keys" ]; then cat id_*.pub >> ~/.ssh/authorized_keys fi -echo "\n" +echo "" echo "Install and config python & jupyter..." apt-get update && \ apt-get install -y ipmitool && modprobe ipmi_devintf && \ @@ -34,7 +34,7 @@ if [ $? -eq 0 ]; then echo "check nvidia drivers..." nvidia-smi - echo "\n" + echo "" echo "Setup successfully finished" fi diff --git a/setup_bcache.sh b/setup_bcache.sh index 67d9e77..2d411ed 100644 --- a/setup_bcache.sh +++ b/setup_bcache.sh @@ -18,24 +18,24 @@ while [ -b /dev/bcache0 ] exit fi -echo "Setup bcache... " -apt-get update && \ -apt-get install -y bcache-tools && \ +echo "Clean disks and setup bcache... " dd if=/dev/zero if=$ssddev bs=512 count=8 && \ dd if=/dev/zero if=$hdddev bs=512 count=8 && \ wipefs -a $ssddev && \ wipefs -a $hdddev && \ -make-bcache -C $ssddev -B $hdddev --writeback && \ -echo $sequential_cutoff > /sys/block/bcache0/bcache/sequential_cutoff && \ -echo "ACTION==\"add\", SUBSYSTEM==\"block\", ENV{MAJOR}==\"252\", ATTR{bcache/sequential_cutoff}=\"$sequential_cutoff\"" \ -> /etc/udev/rules.d/99-bcache_sequential_cutoff.rules && \ -udevadm test /sys/block/bcache0 +apt-get update && \ +apt-get install -y bcache-tools && \ +make-bcache -C $ssddev -B $hdddev --writeback + +echo "Wait until device is ready... " +while [ ! -b /dev/bcache0 ]; do sleep 1; done if [ $? -eq 0 ]; then - echo "Wait until device is ready... " - while [ ! -b /dev/bcache0 ]; do sleep 1; done - - echo "Fromat and mount bcache device... " + echo "Config, format and mount bcache device... " + echo $sequential_cutoff > /sys/block/bcache0/bcache/sequential_cutoff && \ + echo "ACTION==\"add\", SUBSYSTEM==\"block\", ENV{MAJOR}==\"252\", ATTR{bcache/sequential_cutoff}=\"$sequential_cutoff\"" \ + > /etc/udev/rules.d/99-bcache_sequential_cutoff.rules && \ + udevadm test /sys/block/bcache0 && \ mkfs.ext4 /dev/bcache0 && \ mkdir /mnt/bcache && \ mount /dev/bcache0 /mnt/bcache && \ @@ -43,7 +43,7 @@ if [ $? -eq 0 ]; then fi if [ $? -eq 0 ]; then - echo "Config home directory for new users on bcache partition... " + echo "Config default home directory for new users on bcache partition... " mkdir /mnt/bcache/home && \ echo "#" >> /etc/default/useradd && \ echo "# Modifications:" >> /etc/default/useradd && \ diff --git a/setup_cuda.sh b/setup_cuda.sh index 4eb85f8..6503b99 100644 --- a/setup_cuda.sh +++ b/setup_cuda.sh @@ -23,14 +23,14 @@ fi distribution=$(. /etc/os-release;echo $ID$VERSION_ID | sed -e 's/\.//g') architecture="x86_64" -echo "\n" -echo "Install drivers..." +echo "" +echo "Install requirements..." apt-get update && \ apt-get install -y linux-headers-$(uname -r) software-properties-common if [ $? -eq 0 ]; then - echo "\n" - echo "Install the CUDA repository public GPG key..." + echo "" + echo "Setup the CUDA repository public GPG key..." apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/$distribution/$architecture/7fa2af80.pub && \ wget https://developer.download.nvidia.com/compute/cuda/repos/$distribution/$architecture/cuda-$distribution.pin && \ mv cuda-$distribution.pin /etc/apt/preferences.d/cuda-repository-pin-600 @@ -38,24 +38,26 @@ if [ $? -eq 0 ]; then fi if [ $? -eq 0 ]; then - echo "\n" + echo "" echo "Setup the CUDA network repository..." add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/$distribution/$architecture/ /" fi if [ $? -eq 0 ]; then - echo "\n" + echo "" echo "install CUDA..." - #Installs all CUDA Toolkit and Driver packages. Handles upgrading to the next version of the cuda package when it's released. - #Use the --no-install-recommends option for a lean driver install without any dependencies on X packages + #Installs CUDA Toolkit and Driver packages. + #Use the --no-install-recommends option should prevent install any dependencies on X packages + #It still installes alot of dependencies, but fortunately it seams not to setup x-server apt-get update && \ apt-get install -y --no-install-recommends cuda-11-2 fi if [ $? -eq 0 ]; then - echo "\n" + echo "" echo "install libcudnn8..." - #Latest available version from nvidia ubuntu1804 repo: + #Latest available version from nvidia ubuntu1804 repo + #For the current Ubuntu version it was not available. But it seams to work anyway. wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/libcudnn8_8.1.1.33-1+cuda11.2_amd64.deb && \ apt-get install -y ./libcudnn8_8.1.1.33-1+cuda11.2_amd64.deb && \ rm ./libcudnn8_8.1.1.33-1+cuda11.2_amd64.deb && \ @@ -65,9 +67,7 @@ if [ $? -eq 0 ]; then fi if [ $? -eq 0 ]; then - #reboot system - #systemctl reboot echo "" echo "Setup successfully finished" - echo "Type \"systemctl reboot\" to reboot system" + echo "Type \"sudo systemctl reboot\" to reboot system for loading GPU drivers)" fi