1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
| # install cuda
$ wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
$ sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
$ wget https://developer.download.nvidia.com/compute/cuda/11.5.2/local_installers/cuda-repo-wsl-ubuntu-11-5-local_11.5.2-1_amd64.deb
$ sudo dpkg -i cuda-repo-wsl-ubuntu-11-5-local_11.5.2-1_amd64.deb
$ sudo apt-key add /var/cuda-repo-wsl-ubuntu-11-5-local/7fa2af80.pub
$ sudo apt-get update
$ sudo apt-get -y install cuda
# set env
$ echo 'export CUDA_PATH=/usr/local/cuda-11.5' >> ${HOME}/.bashrc
$ echo 'export LD_LIBRARY_PATH=/usr/local/cuda-11.5/lib64:${LD_LIBRARY_PATH}' >> ${HOME}/.bashrc
$ echo 'export PATH=/usr/local/cuda-11.5/bin:${PATH}' >> ${HOME}/.bashrc
$ echo 'export CUDA_VISIBLE_DEVICES=0' >> ${HOME}/.bashrc
$ source ${HOME}/.bashrc
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Thu_Nov_18_09:45:30_PST_2021
Cuda compilation tools, release 11.5, V11.5.119
Build cuda_11.5.r11.5/compiler.30672275_0
$ cat /usr/local/cuda-11.5/version.json ❮ 130
{
"cuda" : {
"name" : "CUDA SDK",
"version" : "11.5.2"
},
"cuda_cudart" : {
"name" : "CUDA Runtime (cudart)",
"version" : "11.5.117"
},
"cuda_cuobjdump" : {
"name" : "cuobjdump",
"version" : "11.5.119"
},
"cuda_cupti" : {
"name" : "CUPTI",
"version" : "11.5.114"
},
"cuda_cuxxfilt" : {
"name" : "CUDA cu++ filt",
"version" : "11.5.119"
},
"cuda_demo_suite" : {
"name" : "CUDA Demo Suite",
"version" : "11.5.50"
},
"cuda_gdb" : {
"name" : "CUDA GDB",
"version" : "11.5.114"
},
"cuda_memcheck" : {
"name" : "CUDA Memcheck",
"version" : "11.5.114"
},
"cuda_nsight" : {
"name" : "Nsight Eclipse Plugins",
"version" : "11.5.114"
},
"cuda_nvcc" : {
"name" : "CUDA NVCC",
"version" : "11.5.119"
},
"cuda_nvdisasm" : {
"name" : "CUDA nvdisasm",
"version" : "11.5.119"
},
"cuda_nvml_dev" : {
"name" : "CUDA NVML Headers",
"version" : "11.5.50"
},
"cuda_nvprof" : {
"name" : "CUDA nvprof",
"version" : "11.5.114"
},
"cuda_nvprune" : {
"name" : "CUDA nvprune",
"version" : "11.5.119"
},
"cuda_nvrtc" : {
"name" : "CUDA NVRTC",
"version" : "11.5.119"
},
"cuda_nvtx" : {
"name" : "CUDA NVTX",
"version" : "11.5.114"
},
"cuda_nvvp" : {
"name" : "CUDA NVVP",
"version" : "11.5.126"
},
"cuda_samples" : {
"name" : "CUDA Samples",
"version" : "11.5.56"
},
"cuda_sanitizer_api" : {
"name" : "CUDA Compute Sanitizer API",
"version" : "11.5.114"
},
"cuda_thrust" : {
"name" : "CUDA C++ Core Compute Libraries",
"version" : "11.5.62"
},
"libcublas" : {
"name" : "CUDA cuBLAS",
"version" : "11.7.4.6"
},
"libcufft" : {
"name" : "CUDA cuFFT",
"version" : "10.6.0.107"
},
"libcufile" : {
"name" : "GPUDirect Storage (cufile)",
"version" : "1.1.1.25"
},
"libcurand" : {
"name" : "CUDA cuRAND",
"version" : "10.2.7.107"
},
"libcusolver" : {
"name" : "CUDA cuSOLVER",
"version" : "11.3.2.107"
},
"libcusparse" : {
"name" : "CUDA cuSPARSE",
"version" : "11.7.0.107"
},
"libnpp" : {
"name" : "CUDA NPP",
"version" : "11.5.1.107"
},
"libnvjpeg" : {
"name" : "CUDA nvJPEG",
"version" : "11.5.4.107"
},
"nsight_compute" : {
"name" : "Nsight Compute",
"version" : "2021.3.1.4"
},
"nsight_systems" : {
"name" : "Nsight Systems",
"version" : "2021.3.3.2"
},
"nvidia_fs" : {
"name" : "NVIDIA file-system",
"version" : "2.9.5"
}
}
# Build sample program
$ sudo apt-get install -y g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev
$ sudo rm -rf cuda-samples > /dev/null 2>&1
$ sudo git clone https://github.com/NVIDIA/cuda-samples.git
$ cd cuda-samples/Samples/1_Utilities/deviceQuery/
$ sudo make
$ sudo ./deviceQuery
$ cd ../../../../cuda-samples/Samples/1_Utilities/bandwidthTest/
$ sudo make
$ sudo ./bandwidthTest
$ cd ../../../../cuda-samples/Samples/4_CUDA_Libraries/simpleCUBLAS
$ sudo make
$ sudo ./simpleCUBLAS
$ cd ../../../../cuda-samples/Samples/4_CUDA_Libraries/simpleCUFFT/
$ sudo make
$ sudo ./simpleCUFFT
|