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

From Teknologisk videncenter
Jump to: navigation, search
m (Installation af cuda)
(Installation af cuda)
 
(8 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
Follow this tutorial: http://www.quantstart.com/articles/Installing-Nvidia-CUDA-on-Ubuntu-14-04-for-Linux-GPU-Computing
 
Follow this tutorial: http://www.quantstart.com/articles/Installing-Nvidia-CUDA-on-Ubuntu-14-04-for-Linux-GPU-Computing
  
=Kommandoer=
+
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!
  
Følgende kommando downloader CUDA fra nvidias hjemmeside, direkte til maskinen istedet for at downloade den til vores maskine og så overføre den efterfølgende.
+
Note: .bash_profile is actually just called .profile
<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>
 
  
  
chmod bruges til at ændre skrive rettighederne, +x står for execution, 
+
CUDA + OpenMPI install script:
<source lang=cli>
 
chmod +x cuda_5.0.35_linux_64_ubuntu11.10-1.run
 
</source>
 
  
 +
<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>
  
Installer dependencies
 
<source lang=cli>
 
aptitude install freeglut3-dev build-essential gcc-4.4 g++-4.4 -y
 
ln -s /usr/lib/x86_64-linux-gnu/libglut.so /usr/lib/libglut.so
 
</source>
 
  
  
Følgende kommando starter installationen af CUDA  
+
CUDA samples compiling and test script:
<source lang=cli>
 
./cuda_5.0.35_linux_64_ubuntu11.10-1.run
 
</source>
 
  
 
+
<code><pre>
Hvis den siger der skal genstartes under forløbet, så genstart maskinen og kør installeren igen.
+
#!/bin/bash
tilføj følgende til .bashrc
+
#####################################
<source lang=cli>
+
# Made by Jesper Larsen, 28-10-2014 #
export PATH=/usr/local/cuda/bin:$PATH
+
#####################################
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
+
#
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/libnvvp/
+
# CUDA samples compile and test GPU
</source>
+
#
Test ved at lave en make /usr/local/cuda/samples/0_Simple/clock og kør ./clock
+
# Getting: Hostname, IP, Current date
 
+
IP=$(hostname -I | awk '{print $1}')
=Links=
+
Host=$(host $IP | awk '{print $5}' | cut -d '.' -f1)
*[http://forums.nvidia.com/index.php?showtopic=198030 After]
+
DATE=`date +%Y_%m_%d-%H_%M`
 
+
#Script:
{{Source cli}}
+
compile_cuda6_5_rev14="/home/hpcadmin/installdir/testing/CUDA/NVIDIA_CUDA-6.5_Samples/bin/"
[[Category:Cluster]][[Category:Ubuntu]]
+
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
 +
</pre></code>

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