first i use ubuntu 16.04
won@won-desktop:~$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Wed_Apr_11_23:16:29_CDT_2018
Cuda compilation tools, release 9.2, V9.2.88
won@won-desktop:~$ nvidia-smi
Sat Jul 7 22:40:14 2018
±----------------------------------------------------------------------------+
| NVIDIA-SMI 390.67 Driver Version: 390.67 |
|-------------------------------±---------------------±---------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 108… Off | 00000000:0E:00.0 On | N/A |
| 0% 34C P8 9W / 300W | 548MiB / 11177MiB | 0% Default |
±------------------------------±---------------------±---------------------+
#include
#include <stdio.h>
#include “common/book.h”
global void add(int a, int b, int *c){
*c=a+b;
}
int main(){
int c;
int *dev_c;
HANDLE_ERROR(cudaMalloc( (void**)&dev_c, sizeof(int) ) );
add<<<1,1>>>(2,7, dev_c);
HANDLE_ERROR( cudaMemcpy( &c, dev_c, sizeof(int),cudaMemcpyDeviceToHost));
printf("2+7 = %d",c);
cudaFree(dev_c);
return 0;
}
and i have trouble like this
won@won-desktop:~/cuda_example$ nvcc ex1.cu
won@won-desktop:~/cuda_example$ ./a.out
CUDA driver version is insufficient for CUDA runtime version in ex1.cu at line 14
won@won-desktop:~/cuda_example$
i dont know why is it not run…could u help me ?