]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/blobdiff - src/fft_cufft.cpp
Remove unnecessary calls to cudaStreamSynchronize()
[hercules2020/kcf.git] / src / fft_cufft.cpp
index c7a9e2f1f3197de294b6adde40f60b610462eacb..5c0da667c6916ac78582b5dd9a4578b5cfc85a6d 100644 (file)
@@ -93,7 +93,6 @@ void cuFFT::forward_window(MatScaleFeats &feat, ComplexMat &complex_result, MatS
     else
         cudaErrorCheck(cufftExecR2C(plan_fw_all_scales, temp_data, complex_result.get_dev_data()));
 #endif
-    CudaSafeCall(cudaStreamSynchronize(cudaStreamPerThread));
 }
 
 void cuFFT::inverse(ComplexMat &complex_input, MatScales &real_result)
@@ -111,8 +110,9 @@ void cuFFT::inverse(ComplexMat &complex_input, MatScales &real_result)
     else
         cudaErrorCheck(cufftExecC2R(plan_i_all_scales, in, out));
 #endif
-    // TODO: Investigate whether this scalling is needed or not
     cudaErrorCheck(cublasSscal(cublas, real_result.total(), &alpha, out, 1));
+    // The result is a cv::Mat, which will be accesses by CPU, so we
+    // must synchronize with the GPU here
     CudaSafeCall(cudaStreamSynchronize(cudaStreamPerThread));
 }