Doubts about cublasZdotu

I´m having doubts when using cublasZdotu function.

The dot product of vectors x and y is resulting in zero.

Set (where, M is dimension the input vector):

cuDoubleComplex *Fp;
cuDoubleComplex result;

cudaMalloc((void**)&d_rp, (M)*sizeof(cuDoubleComplex));
cudaMemcpy(d_rp, Fp, (M)*sizeof(cuDoubleComplex), cudaMemcpyHostToDevice);
cublasStatus = cublasZdotu(cublasHandle, M, d_rp, 1, d_rp, 1, &result);
printf("\t Result = %e %e\n", result.x, result.y);

Fp has nonzero values.
I´m not finding my mistake!

I can’t spot anything wrong with the code, other than that I don’t see a call to initialize CUBLAS. Make sure you check the status of every CUDA and CUBLAS API call. cublasZdotu() may have failed to execute due to prior errors. BTW, it is usually a bit more robust to use the following idiom for memory copies, should you ever chose to change the type of the array elements:

cuDoubleComplex *Fp, d_rp;
cudaMemcpy(d_rp, Fp, M
sizeof(d_rp[0]), cudaMemcpyHostToDevice);

My device has capability 1.2.

Does device CUDA (capability 1.2) support double precision floating point numbers ?


Double precision computation requires compute capability 1.3 or higher.