lsb_release -a
我的版本是
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
nvidia-smi
Fri Feb 24 15:48:08 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.43.01 Driver Version: 516.01 CUDA Version: 11.7 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... On | 00000000:02:00.0 Off | N/A |
| N/A 0C P0 N/A / N/A | 0MiB / 4096MiB | 1% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "/usr/local/cuda-11.7/bin/nvcc",
"args": [
"-I/home/user/cuda-11.7/include",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
{
"version": "0.2.0",
"configurations": [
{
"name": "CUDA Program",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/test",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"preLaunchTask": "build"
}
]
}
{
"configurations": [
{
"name": "Linux",
"compilerPath": "/usr/local/cuda/bin/nvcc",
"intelliSenseMode": "linux-gcc-x64",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/cuda-11.7/include/**"
],
"defines": [],
"browse": {
"path": [
"${workspaceFolder}",
"/usr/local/cuda/include/**"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"cStandard": "c17",
"cppStandard": "c++14"
}
],
"version": 4
}
#include
#include
__global__ void add(int a, int b, int *c)
{
*c = a + b;
}
int main()
{
int a = 2, b = 3, c;
int *d_c;
cudaMalloc((void **)&d_c, sizeof(int));
cudaMemcpy(&c, d_c, sizeof(int), cudaMemcpyDeviceToHost);
std::cout << a << " + " << b << " = " << c << std::endl;
cudaFree(d_c);
return 0;
}
predy@DESKTOP-IU6IR4M:~/DL_Deploy/1.CUDA_cudnn_Installation$ cat /usr/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
#define CUDNN_MAJOR 8
#define CUDNN_MINOR 6
#define CUDNN_PATCHLEVEL 0