Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
CUBLAS and MAGMA by example.pdf
Скачиваний:
36
Добавлен:
22.03.2016
Размер:
2.45 Mб
Скачать

Chapter 1

CUDA installation

1.1Installing CUDA environment

Both CUBLAS and MAGMA need CUDA (Compute Uni ed Device Architecture) environment. In fact CUBLAS is a part of CUDA. In this chapter we will show how to install CUDA 5.5 on Redhat 6.3. At the time of writting this text the download website was https://developer.nvidia.com/ cuda-downloads. On the site one can nd http://developer.download. nvidia.com/compute/cuda/5_5/rel/docs/CUDA_Getting_Started_Linux. pdf which is a good starting point.

Before getting started, we are required to remove nouveau drivers from the system (if they are enabled). Usually if the system installer detects Nvidia cards, it installs nouveau drivers. If nouveau is enabled it is impossible to install proprietary Nvidia drivers which are necessary for CUDA Toolkit. To disable nouveau it su ces to perform (as root) the following three steps.

#echo -e "\nblacklist nouveau" >> /etc/modprobe.d/blacklist.conf

#dracut /boot/initramfs-$(uname -r).img $(uname -r)

#reboot

To compile CUDA we shall also need some additional packages

#yum install gcc-c++ make

#yum install kernel-devel

#yum install freeglut-devel libXi-devel libXmu-devel

#yum install openmpi-devel

Since in Redhat OpenMPI is installed in /usr/lib64/openmpi the following exports will be needed in compilation of CUDA samples

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/openmpi/lib $ export OPENMPI_HOME=/usr/lib64/openmpi

$ export PATH=/usr/lib64/openmpi/bin:$PATH

1.1 Installing CUDA environment

9

As we have mentioned the CUDA Toolkit can be downloaded from https: //developer.nvidia.com/cuda-downloads

#In the case of Redhat 6.x

$ wget http://developer.download.nvidia.com/compute/cuda/5_5/ rel/installers/cuda_5.5.22_linux_64.run

The graphical display manager must not be running during the CUDA video driver installation. Hence we have to logout the desktop, switch into console mode and stop the graphical display manager. Using the text console we enter the directory with cuda 5.5.22 linux 64.run downloaded. The default installation directory is

/usr/local/cuda-5.5 so root privileges are needed.

#sh cuda_5.5.22_linux_64.run

It is important to set properly all the paths mentioned by the installer:

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 319.37? ((y)es/(n)o/(q)uit): yes

Install the CUDA 5.5 Toolkit? ((y)es/(n)o/(q)uit): yes Enter Toolkit Location [ default is /usr/local/cuda-5.5 ]: Install the CUDA 5.5 Samples? ((y)es/(n)o/(q)uit): yes Enter CUDA Samples Location

[ default is /root/NVIDIA_CUDA-5.5_Samples ]: Installing the NVIDIA display driver...

Installing the CUDA Toolkit in /usr/local/cuda-5.5 ...

Installing the CUDA Samples in /root/NVIDIA_CUDA-5.5_Samples ...

Copying samples to /root/NVIDIA_CUDA-5.5_Samples/NVIDIA_CUDA-5.5_Samples now...

Finished copying samples.

===========

= Summary =

===========

Driver:

Installed

Toolkit:

Installed in /usr/local/cuda-5.5

Samples:

Installed in /root/NVIDIA_CUDA-5.5_Samples

*Please make sure your PATH includes /usr/local/cuda-5.5/bin

*Please make sure your LD_LIBRARY_PATH

*for 32-bit Linux distributions includes /usr/local/cuda-5.5/lib

1.1 Installing CUDA environment

10

*for 64-bit Linux distributions includes /usr/local/cuda-5.5/lib64:/lib

*OR

*for 32-bit Linux distributions add /usr/local/cuda-5.5/lib

*for 64-bit Linux distributions add /usr/local/cuda-5.5/lib64

*and /lib

*to /etc/ld.so.conf and run ldconfig as root

*To uninstall CUDA, remove the CUDA files in /usr/local/cuda-5.5

*Installation Complete

Please see CUDA_Getting_Started_Linux.pdf in /usr/local/cuda-5.5/doc/pdf

for detailed information on setting up CUDA.

Logfile is /tmp/cuda_install_30834.log

For users working in text mode it is important to read point 6 from CUDA Getting Started Guide For Linux . The script from the guide

#!/bin/bash /sbin/modprobe nvidia if [ "$?" -eq 0 ]; then

# Count the number of NVIDIA controllers found. NVDEVS=`lspci | grep -i NVIDIA`

N3D=`echo "$NVDEVS" | grep "3D controller" | wc -l`

NVGA=`echo "$NVDEVS" | grep "VGA compatible controller" | wc -l` N=`expr $N3D + $NVGA - 1`

for i in `seq 0 $N`; do

mknod -m 666 /dev/nvidia$i c 195 $i done

mknod -m 666 /dev/nvidiactl c 195 255 else

exit 1 fi

should be copied for example to /etc/rc.local. The script loads the driver kernel module and creates the entries in device les /dev/nvidia* (this is performed automatically if a GUI environment is initialized).

After adding to $HOME/.bashrc the entries

export OPENMPI_HOME=/usr/lib64/openmpi export CUDA_HOME=/usr/local/cuda-5.5 export LD_LIBRARY_PATH=${CUDA_HOME}/lib64

PATH=${CUDA_HOME}/bin:${OPENMPI_HOME}/bin:${PATH}

1.1 Installing CUDA environment

11

export PATH

and

# reboot

one can copy samples to $HOME directory and make the examples:

$ cp -r /usr/local/cuda-5.5/samples ~ $ cd ~/samples

$ make

If the CUDA software is installed and con gured correctly, the executable:

$ ~/samples/1_Utilities/deviceQuery/deviceQuery

should display the properties of the detected CUDA devices. The nbody executable:

$ ~/samples/5_Simulations/nbody/nbody -benchmark -numdevices=2

# (in the case of two devices)

gives the opportunity to check GPU performance.

In Tesla cards one can check the state of devices using

$ nvidia-smi

# man nvidia-smi

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]