Difference between revisions of "Cluster der kan alt/Installation af CUDA"

From Teknologisk videncenter
Jump to: navigation, search
(Installation af cuda)
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
=Installation af cuda=
 
=Installation af cuda=
Først skal cuda hentes fra nvidias hjemmeside på en windows pc.
+
Follow this tutorial: http://www.quantstart.com/articles/Installing-Nvidia-CUDA-on-Ubuntu-14-04-for-Linux-GPU-Computing
Der skal hentes 3 installations filer
 
Toolkit, Drivers, og SDK
 
Og det skal hentes fra http://developer.nvidia.com/cuda-downloads
 
  
Det skal derefter ligges over på linux maskinen via programmet pscp  som kan hentes på puttys hjemmeside
+
Note: Suggest that you navigate to sub-directories in the samples directory and "make" individual projects. To "make" the whole samples directory (as the tutorial suggests) takes around an hour!
- Man kører filerne over via CMD
 
  
Når filerne er på maskinen kører man en chmod +x og skriver filnavnet efter "x"et.
+
Note: .bash_profile is actually just called .profile
  
for at kører filerne derefter trykker man ./ og filens navn
 
Rækkefølgen skal være
 
Toolkit - Drivers - SDK
 
  
du skal bruge cuda libraries i din library path så opret /etc/ld.so.conf.d/cuda.conf aog add disse linjer:
+
CUDA + OpenMPI install script:
/usr/local/cuda/lib64
 
/usr/local/cuda/lib
 
  
 +
<code><pre>
 +
#!/bin/bash
 +
#####################################
 +
# Made by Jesper Larsen, 28-10-2014 #
 +
#####################################
 +
#
 +
# CUDA + OpenMPI installer
 +
#
 +
echo "Preparing for install..."
 +
apt-get update
 +
apt-get install -y build-essential
 +
echo "Creating folders..."
 +
mkdir ~/installdir
 +
mkdir ~/installdir/dl
 +
mkdir ~/installdir/dl/CUDA
 +
# Downloading, installing deb.
 +
if [ -f "/home/hpcadmin/installdir/dl/CUDA/cuda-repo-ubuntu1404_6.5-14_amd64.deb" ];
 +
then
 +
echo "cuda6_5_rev14 .deb package found."
 +
echo "Installing: cuda65rev14..."
 +
dpkg -i /home/hpcadmin/installdir/dl/CUDA/cuda-repo-ubuntu1404_6.5-14_amd64.deb
 +
else
 +
echo "cuda6_5_rev14 .deb package _NOT_ found."
 +
echo "Downloading and installing: cuda6_5_rev14..."
 +
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_6.5-14_amd64.deb /home/hpcadmin/installdir/dl/CUDA/
 +
dpkg -i /home/hpcadmin/installdir/dl/CUDA/cuda-repo-ubuntu1404_6.5-14_amd64.deb
 +
fi
 +
apt-get update
 +
apt-get install -y cuda
 +
echo "export PATH=/usr/local/cuda-6.5/bin:$PATH" >> ~/.profile
 +
echo "export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64:$LD_LIBRARY_PATH" >> ~/.profile
 +
source ~/.profile
 +
#Installing OpenMPI
 +
echo "Installing OpenMPI"
 +
apt-get install -y libopenmpi-dev openmpi-bin openmpi-doc
 +
echo "========================================="
 +
echo "!!! CUDA + OpenMPI - INSTALL COMPLETE !!!"
 +
echo "========================================="
 +
echo "RESTART IN 20 SECONDS FOR DRIVERS TO WORK"
 +
echo ""
 +
echo "Before proceeding to test the GPU cards we will ensure that the drivers are"
 +
echo "correctly installed. The following line will provide us with the driver version."
 +
echo "Run this for testing after reboot: sudo cat /proc/driver/nvidia/version"
 +
sleep 20
 +
reboot now
 +
</pre></code>
  
kør ldconfig som root for at få det til at virke:
 
sudo ldconfig
 
  
  
du skal også adde  /usr/local/cuda/bin til din sti. du kan gøre det ved at adde
+
CUDA samples compiling and test script:
PATH="$PATH:/usr/local/cuda/bin"
 
  
Alt er gemt i standard foldersne
+
<code><pre>
 
+
#!/bin/bash
=Kommandoer=
+
#####################################
 
+
# Made by Jesper Larsen, 28-10-2014 #
<source lang=cli>
+
#####################################
wget http://developer.download.nvidia.com/compute/cuda/5_0/rel-update-1/installers/cuda_5.0.35_linux_64_ubuntu11.10-1.run
+
#
</source>
+
# CUDA samples compile and test GPU
 
+
#
<source lang=cli>
+
# Getting: Hostname, IP, Current date
chmod +x cuda_5.0.35_linux_64_ubuntu11.10-1.run
+
IP=$(hostname -I | awk '{print $1}')
</source>
+
Host=$(host $IP | awk '{print $5}' | cut -d '.' -f1)
 
+
DATE=`date +%Y_%m_%d-%H_%M`
#Installer dependecies
+
#Script:
<source lang=cli>
+
compile_cuda6_5_rev14="/home/hpcadmin/installdir/testing/CUDA/NVIDIA_CUDA-6.5_Samples/bin/"
aptitude install freeglut3-dev build-essential gcc-4.4 g++-4.4 -y
+
if [ -d "/home/hpcadmin/installdir/testing/CUDA/NVIDIA_CUDA-6.5_Samples/bin/" ];
ln -s /usr/lib/x86_64-linux-gnu/libglut.so /usr/lib/libglut.so
+
then
</source>
+
echo "$compile_cuda6_5_rev14 found! Testing instead."
 
+
echo "Testing communication with the GPU..."
<source lang=cli>
+
exec /home/hpcadmin/installdir/testing/CUDA/NVIDIA_CUDA-6.5_Samples/bin/x86_64/linux/release/deviceQuery > /home/hpcadmin/installdir/testing/CUDA/results/$Host-$DATE.txt
./cuda_5.0.35_linux_64_ubuntu11.10-1.run
+
else
</source>
+
echo "$compile_cuda6_5_rev14 _NOT_ found. Compiling then testing."
 
+
echo "Copying CUDA samples to testing directory..."
Hvis den siger der skal genstartes under forløbet, så genstart maskinen og kør installeren igen.
+
sh /usr/local/cuda-6.5/bin/cuda-install-samples-6.5.sh /home/hpcadmin/installdir/testing/CUDA/
tilføj følgende til .bashrc
+
echo "Compiling CUDA samples - TAKES A LONG TIME 30-40 min..."
<source lang=cli>
+
make -C /home/hpcadmin/installdir/testing/CUDA/NVIDIA_CUDA-6.5_Samples/
export PATH=/usr/local/cuda/bin:$PATH
+
echo "Testing communication with the GPU..."
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
+
exec /home/hpcadmin/installdir/testing/CUDA/NVIDIA_CUDA-6.5_Samples/bin/x86_64/linux/release/deviceQuery > /home/hpcadmin/installdir/testing/CUDA/results/$Host-$DATE.txt
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/libnvvp/
+
fi
</source>
+
</pre></code>
Test ved at lave en make /usr/local/cuda/samples/0_Simple/clock og kør ./clock
 
 
 
=Links=
 
*[http://forums.nvidia.com/index.php?showtopic=198030 After]
 
 
 
{{Source cli}}
 
[[Category:Cluster]][[Category:Ubuntu]]
 

Latest revision as of 11:55, 4 November 2014

Installation af cuda

Follow this tutorial: http://www.quantstart.com/articles/Installing-Nvidia-CUDA-on-Ubuntu-14-04-for-Linux-GPU-Computing

Note: Suggest that you navigate to sub-directories in the samples directory and "make" individual projects. To "make" the whole samples directory (as the tutorial suggests) takes around an hour!

Note: .bash_profile is actually just called .profile


CUDA + OpenMPI install script:

#!/bin/bash
#####################################
# Made by Jesper Larsen, 28-10-2014 #
#####################################
#
# CUDA + OpenMPI installer
#
echo "Preparing for install..."
apt-get update
apt-get install -y build-essential
echo "Creating folders..."
mkdir ~/installdir
mkdir ~/installdir/dl
mkdir ~/installdir/dl/CUDA
# Downloading, installing deb.
if [ -f "/home/hpcadmin/installdir/dl/CUDA/cuda-repo-ubuntu1404_6.5-14_amd64.deb" ];
then
	echo "cuda6_5_rev14 .deb package found."
	echo "Installing: cuda65rev14..."
	dpkg -i /home/hpcadmin/installdir/dl/CUDA/cuda-repo-ubuntu1404_6.5-14_amd64.deb
else
	echo "cuda6_5_rev14 .deb package _NOT_ found."
	echo "Downloading and installing: cuda6_5_rev14..."
	wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_6.5-14_amd64.deb /home/hpcadmin/installdir/dl/CUDA/
	dpkg -i /home/hpcadmin/installdir/dl/CUDA/cuda-repo-ubuntu1404_6.5-14_amd64.deb
fi
apt-get update
apt-get install -y cuda 
echo "export PATH=/usr/local/cuda-6.5/bin:$PATH" >> ~/.profile
echo "export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64:$LD_LIBRARY_PATH" >> ~/.profile
source ~/.profile
#Installing OpenMPI
echo "Installing OpenMPI"
apt-get install -y libopenmpi-dev openmpi-bin openmpi-doc
echo "========================================="
echo "!!! CUDA + OpenMPI - INSTALL COMPLETE !!!"
echo "========================================="
echo "RESTART IN 20 SECONDS FOR DRIVERS TO WORK"
echo ""
echo "Before proceeding to test the GPU cards we will ensure that the drivers are"
echo "correctly installed. The following line will provide us with the driver version."
echo "Run this for testing after reboot: sudo cat /proc/driver/nvidia/version"
sleep 20
reboot now


CUDA samples compiling and test script:

#!/bin/bash
#####################################
# Made by Jesper Larsen, 28-10-2014 #
#####################################
#
# CUDA samples compile and test GPU
# 
# Getting: Hostname, IP, Current date
IP=$(hostname -I | awk '{print $1}')
Host=$(host $IP | awk '{print $5}' | cut -d '.' -f1)
DATE=`date +%Y_%m_%d-%H_%M`
#Script:
compile_cuda6_5_rev14="/home/hpcadmin/installdir/testing/CUDA/NVIDIA_CUDA-6.5_Samples/bin/"
if [ -d "/home/hpcadmin/installdir/testing/CUDA/NVIDIA_CUDA-6.5_Samples/bin/" ];
then
	echo "$compile_cuda6_5_rev14 found! Testing instead."
	echo "Testing communication with the GPU..."
	exec /home/hpcadmin/installdir/testing/CUDA/NVIDIA_CUDA-6.5_Samples/bin/x86_64/linux/release/deviceQuery > /home/hpcadmin/installdir/testing/CUDA/results/$Host-$DATE.txt
else
	echo "$compile_cuda6_5_rev14 _NOT_ found. Compiling then testing."
	echo "Copying CUDA samples to testing directory..."
	sh /usr/local/cuda-6.5/bin/cuda-install-samples-6.5.sh /home/hpcadmin/installdir/testing/CUDA/
	echo "Compiling CUDA samples - TAKES A LONG TIME 30-40 min..."
	make -C /home/hpcadmin/installdir/testing/CUDA/NVIDIA_CUDA-6.5_Samples/
	echo "Testing communication with the GPU..."
	exec /home/hpcadmin/installdir/testing/CUDA/NVIDIA_CUDA-6.5_Samples/bin/x86_64/linux/release/deviceQuery > /home/hpcadmin/installdir/testing/CUDA/results/$Host-$DATE.txt
fi