diff --git a/paddle/fluid/operators/spectral_op.cu b/paddle/fluid/operators/spectral_op.cu index 8e42a070a398ed0aad144bca24bc123092bb6b35..e97af7cea7e08787c6864fa80c85af085326b7de 100644 --- a/paddle/fluid/operators/spectral_op.cu +++ b/paddle/fluid/operators/spectral_op.cu @@ -313,7 +313,12 @@ void exec_fft(const DeviceContext& ctx, const Tensor* X, Tensor* out, // create plan FFTConfigKey key = create_fft_configkey(collapsed_input, collapsed_output, signal_ndim); - if (CUFFT_VERSION < 10200) { + bool using_cache = false; +#if !defined(CUFFT_VERSION) || (CUFFT_VERSION < 10200) + using_cache = true; +#endif + + if (using_cache) { const int64_t device_id = static_cast( reinterpret_cast(&collapsed_input.place()) ->GetDeviceId());