CUDA Install

2016 - 06 - 13

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


see official simple example, further: doc & example

Debug Using Parallel-Nsight


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

dpkg -i ./cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
apt-get update
apt-get install cuda -y

## old method with .run (deprecated)

sudo apt-get install -y linux-headers-$(uname -r) linux-source && \
sudo service lightdm stop ||: && \
wget -O && \
sudo sh --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.

Write a Comment