 #    include <fftw3.h>    // kinda problematic to mix this with cufft, but should work if it isn't cufftw.h
 #    include "algorithms/vectorReduce.hpp"
 #    include "algorithms/vectorElementwise.hpp"
+#endif
+#if DEBUG_CUDASHRINKWRAP == 2
+#   include "io/writeOutFuncs/writeOutFuncs.hpp"
 #endif
 #include "libs/cudacommon.hpp"
 #include "libs/checkCufftError.hpp"

                /* apply domain constraints to g' to get g */
                cudaKernelApplyHioDomainConstraints<<<nBlocks,nThreads,0,rStream >>>
                    ( dpgPrevious, dpCurData, dpIsMasked, nElements, rHioBeta );

                /* Transform new guess g for f back into frequency space G' */
                CUFFT_ERROR( cufftExecC2C( ftPlan, dpgPrevious, dpCurData, CUFFT_FORWARD ) );

                /* Replace absolute of G' with measured absolute |F| */
                cudaKernelApplyComplexModulus<<<nBlocks,nThreads,0,rStream>>>
                    ( dpCurData, dpCurData, dpIntensity, nElements );
                CUDA_ERROR( cudaPeekAtLastError() );

                CUFFT_ERROR( cufftExecC2C( ftPlan, dpCurData, dpCurData, CUFFT_INVERSE ) );
            } // HIO loop
