I have been reading through many of the SO questions related to constant memory and I still don't understand why my program is not working. Overall it looks like follows
Common.cuh
__constant__ int numElements;
__global__
void kernelFunction();
Common.cu
#include "Common.cuh"
#include <stdio.h>
__global__
kernelFunction()
{
   printf("NumElements = %d", numElements);
}
Test.cu
#include "Common.cuh"
int main()
{
   int N = 100;
   cudaMemcpyToSymbol(numElements,&N,sizeof(int));
   kernelFunction<<<1,1>>>();
   cudaDeviceSynchronize();
   return 0;
}
It compiles with no error but when printing the value of numElements I just get a random value. Can someone point me in the right direction to get to understand this?
 
    