CUDA Install
see also:
ways of parallel computing in R
//TODO: study & summarize Map, Gather, Scatter etc.
//TODO: see also the notes for campus’ students assignments.
Coursera Course Notes: _GPU notes.docx
Code: github, or desktop search “gpu assignments”.
Compared with “knn-r-project.Rproj”, “knn_cuda.vcxproj” is at least 6k times faster for almost exactly the same job. (diff: data cleaned; windowSize added.) One reason is the R project was using data.frame instead of tada.table. See here for more R performance info.
Multi-dimension Index #
If the index format is [d1_index][d2_index][d3_index][d4_index]
, the index value will be ((d1_index*d2_nr + d2_index)*d3_nr + d3_index)*d4_nr + d4_index
Some Functions #
thrust::sort_by_key #
see official simple example, further: doc & example
Debug Using Parallel-Nsight #
// Print might be more convinient.
ref
single-gpu mode #
multi-gpu mode #
Visual Studio Red Underline #
VS always show the kernel calls are in wrong c++ format, though it will compile anyway. The soluction to get rid of this false negtive, is to use Driver API instead of Runtime API, so <<< >>>
format will not be there.
Install in Ubuntu 16.04.2 #
Important: DO see log file for detail reason if failed.
Download “runfile (local)” from Nvidia.
OBS: .run
asks to uninstall OS’s default GPU driver, so .deb
is better.
new method with .deb #
# 10min, downloading speed 1~8MB/s
if ! dpkg-query -W cuda; then
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
dpkg -i ./cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
apt-get update
apt-get install cuda -y
fi
## old method with .run (deprecated)
sudo apt-get install -y linux-headers-$(uname -r) linux-source && \
sudo service lightdm stop ||: && \
wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run -O cuda_8.0.61_375.26_linux.run && \
sudo sh cuda_8.0.61_375.26_linux.run --driver --toolkit --samples --verbose -silent
(Tip: verbose gives more debug info, silent does not ask questions.)
If there is anything regarding “–kernel-source-path”, make sure:
- installed “linux-source”;
- disabled Nouveau;
- the running kernel is build from the same (major) version of installed gcc as below:
cat /proc/version |grep gcc && gcc --version |grep gcc
Someone said export IGNORE_CC_MISMATCH=1 to ignore this problem, but someone else said it does not work.
We need to reboot to disable “Nouveau” modprobe (also stop lightdm)
Problem: ERR: Kernel module load error: Required key not available
Reason: UEFI.
Solution: disable UEFI’s secure boot. See here for Asus motherboard BIOS/UEFI. Summary: backup all 4 keys; delete PK key; change mode to “other_OS”. evernote backup
To uninstall, see official Installation Guide for Linux.
Problem: kernel API mismatch
Reason: as said, apt’s update leads to API version mismatch.
Solution: install the lastest NVIDIA .deb.
Problem: Existing package manager installation of the driver found. It is strongly recommended that you remove this before continuing.
Reason: already installed.
Solution: use .deb to install.
lready installed.
Solution: use .deb to install.
Problem: ERROR: The Nouveau kernel driver is currently in use by your system.
Reason: as said.
Solution:
sudo -s
lsmod | grep nouveau && \
echo 'blacklist nouveau' >> /etc/modprobe.d/blacklist-nouveau.conf && \
echo 'options nouveau modeset=0' >> /etc/modprobe.d/blacklist-nouveau.conf && \
sudo update-initramfs -u && \
sudo reboot