I have a very strange bug in program. I spent many hours on it but I have not found a solution. I wrote simple program to reproduce my issue. Maybe someone help me. I tried cuda-memcheck & What is the canonical way to check for errors using the CUDA runtime API? but I don't get any errors.
Details:
nvcc version - V6.0.1
gcc version - 4.8.1
Full code:
#include <stdio.h>
__constant__ unsigned long long int bigNumber = 83934243334343;
__device__ bool isFound = false;
__global__ void kernel(int *dev_number) {
unsigned long long int id = threadIdx.x + (blockIdx.x * blockDim.x);
while (id < bigNumber && isFound==false) {
if(id == 10) {
*dev_number = 4;
isFound=true;
}
id++;
}
}
int main(int argc, char *argv[]) {
int number = 0;
int *dev_number;
printf("Number: %d\n", number);
return 0;
}
Compilation and run:
nvcc myprogram.cu
./myprogram
When I run this program I don't get any return value. But when variable - bigNumber has smaller value or I don't use cudaMalloc & cudaMemcpy it works(it means return 0 is called). What connection has to allocate memory for another variable with a constant bigNumber? What's the problem?