Floating point division not working

Good evening! I am new to CUDA.

I am trying to divide two floating type numbers simply by / (division) in kernel. But the result always returns the MAX_NUM of floating data type.
In debugging mode, I set breakpoint on the line contains /(division), but program does not stop at breakpoint. No debugging msg feedback too.
My cuda computing ability is only 1.1. Does anyone meet similar problem? Any input is welcome,

Thanks!

Could you show a self-contained small example where floating-point division does not work? Note that with compute capability 1.1 you are limited to operations on “float”, as “double” requires compute capability >= 1.3 . What CUDA version are you using?

Thanks, njuffa

I am using 4.0. Driver version 260.24

global void float_kernel(float* iarray, int n){
// n = 8;
// Block index
int bx = blockIdx.x;
int by = blockIdx.y;

// Thread index
int tx = threadIdx.x;
int ty = threadIdx.y;
       
int x = tx+bx * blockDim.x;
int y = ty+by * blockDim.y;

int tid = x + y * blockDim.x * gridDim.x;

float phi[4];
uint Idx1;
uint Idx2;

Idx1 = (tid) % (n-1);
if(tid!=0){
    Idx2 = (n-1-tid)%(n-1);
}
else{
    Idx2 = n-1;
}

phi[tid] = (iarray[Idx1*n + Idx2] - iarray[Idx2*n + Idx2])/iarray[Idx1*n + Idx2];

...

}

I guess I should have expressed myself more clearly. By “self-contained example code”, I meant code that one can compile with nvcc without needing any additional files and then run the resulting executable, also without needing any additional files.

Please note that CUDA 4.0 requires a driver r270 or higher. If indeed you are really running with r260 drivers as indicated, CUDA 4.0 should fail to even initialize. Please make sure your program checks the return code of every API call and every kernel launch.

Sorry, that was my fault. I am using 270.41 driver. Here’s example code(in attachment). I still don’t get the arithmetic part. Thanks for reply. I appreciate a lot.
floating_division.cu (2.62 KB)

Thanks njuffa,

The attachment is working now. That is a stupid mistake. Thank you so much.