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)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
=Installation af cuda=
 
=Installation af cuda=
 
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
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!
 
  
=Links=
+
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!
*[http://forums.nvidia.com/index.php?showtopic=198030 After]
 
  
{{Source cli}}
+
Note: .bash_profile is actually just called .profile
[[Category:Cluster]][[Category:Ubuntu]]
+
 
 +
 
 +
CUDA + OpenMPI install script:
 +
 
 +
<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>
 +
 
 +
 
 +
 
 +
CUDA samples compiling and test script:
 +
 
 +
<code><pre>
 +
#!/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
 +
</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