Configuration problem or problem with kernel function

Hello,

I have: Windows 8 x64, CUDA 9.0, NVIDIA GT620M and Visual Studio Community 2017.
I copied the easy code from the book into my program:

#include “stdafx.h”
#include <cuda_runtime.h>

global void add(int a, int b, int *c)
{
*c = a + b;
}

int main()
{
int c;
int *dev_c;

cudaMalloc((void**)&dev_c, sizeof(int));
add<<<1, 1>>>(2, 7, dev_c);
cudaMemcpy(&c,
	dev_c,
	sizeof(int),
	cudaMemcpyDeviceToHost);
printf("2 + 7 = %d\n", c);
cudaFree(dev_c);
return 0;

}

The program compiles correctly but the result is always:

2 + 7 = 0
Why not 9? Where could be the problem?

Regards

GT 620M is a Fermi device and is not supported by CUDA 9.

In the future I suggest using proper CUDA error checking, so you’ll get an indication of problems like this.

Not sure what “proper CUDA error checking” is? Google “proper CUDA error checking”, take the first hit, start reading, and apply it to your code.

Thank you, now everything is clear.
Regards.