diff --git a/cuFFT/1d_mgpu_c2c/1d_mgpu_c2c_example.cpp b/cuFFT/1d_mgpu_c2c/1d_mgpu_c2c_example.cpp index 52929e48..f07f27b3 100644 --- a/cuFFT/1d_mgpu_c2c/1d_mgpu_c2c_example.cpp +++ b/cuFFT/1d_mgpu_c2c/1d_mgpu_c2c_example.cpp @@ -105,6 +105,11 @@ void spmg(dim_t fft, int &batch_size, gpus_t gpus, cpudata_t &h_data_in, cpudata // Execute the plan CUFFT_CALL(cufftXtExecDescriptor(plan, indesc, indesc, CUFFT_FORWARD)); +#if CUFFT_VERSION >= 10400 + // The transform runs on the plan's stream; wait for it before reading back + CUDA_RT_CALL(cudaStreamSynchronize(stream)); +#endif + // Copy output data to CPU CUFFT_CALL(cufftXtMemcpy(plan, reinterpret_cast(h_data_out.data()), reinterpret_cast(indesc), CUFFT_COPY_DEVICE_TO_HOST)); diff --git a/cuFFT/3d_mgpu_c2c/3d_mgpu_c2c_example.cpp b/cuFFT/3d_mgpu_c2c/3d_mgpu_c2c_example.cpp index 55710490..517a922d 100644 --- a/cuFFT/3d_mgpu_c2c/3d_mgpu_c2c_example.cpp +++ b/cuFFT/3d_mgpu_c2c/3d_mgpu_c2c_example.cpp @@ -105,6 +105,11 @@ void spmg(dim_t fft, gpus_t gpus, cpudata_t &h_data_in, cpudata_t &h_data_out, // Execute the plan CUFFT_CALL(cufftXtExecDescriptor(plan, indesc, indesc, CUFFT_FORWARD)); +#if CUFFT_VERSION >= 10400 + // The transform runs on the plan's stream; wait for it before reading back + CUDA_RT_CALL(cudaStreamSynchronize(stream)); +#endif + // Copy output data to CPU CUFFT_CALL(cufftXtMemcpy(plan, reinterpret_cast(h_data_out.data()), reinterpret_cast(indesc), CUFFT_COPY_DEVICE_TO_HOST)); diff --git a/cuFFT/3d_mgpu_r2c_c2r/3d_mgpu_r2c_c2r_example.cpp b/cuFFT/3d_mgpu_r2c_c2r/3d_mgpu_r2c_c2r_example.cpp index 2cf5180a..8bf51f83 100644 --- a/cuFFT/3d_mgpu_r2c_c2r/3d_mgpu_r2c_c2r_example.cpp +++ b/cuFFT/3d_mgpu_r2c_c2r/3d_mgpu_r2c_c2r_example.cpp @@ -155,6 +155,11 @@ void spmg(dim_t fft, gpus_t gpus, cpudata_t &h_data_in, cpudata_t &h_data_out, // Execute the plan_r2c CUFFT_CALL(cufftXtExecDescriptor(plan_r2c, indesc, indesc, CUFFT_FORWARD)); +#if CUFFT_VERSION >= 10400 + // The transform runs on the plan's stream; wait for it before reading back + CUDA_RT_CALL(cudaStreamSynchronize(stream)); +#endif + // Scale complex results float scale{2.f}; scaleComplex(indesc, scale, h_data_out.size(), gpus.size()); @@ -162,6 +167,11 @@ void spmg(dim_t fft, gpus_t gpus, cpudata_t &h_data_in, cpudata_t &h_data_out, // Execute the plan_c2r CUFFT_CALL(cufftXtExecDescriptor(plan_c2r, indesc, indesc, CUFFT_INVERSE)); +#if CUFFT_VERSION >= 10400 + // The transform runs on the plan's stream; wait for it before reading back + CUDA_RT_CALL(cudaStreamSynchronize(stream)); +#endif + // Copy output data to CPU CUFFT_CALL(cufftXtMemcpy(plan_c2r, (void *)h_data_out.data(), (void *)indesc, CUFFT_COPY_DEVICE_TO_HOST));