diff --git a/Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx b/Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx index 3e791c67826b93a072c48eb1a1b91b6721eb41e4..2f611618e2dcd6900e10cd209d5a613d751d8369 100644 --- a/Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx +++ b/Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx @@ -79,17 +79,27 @@ private: ~DomainTransform() ITK_OVERRIDE { + // Clean up all threads allocated threads. + CleanupFFTThreads(); + } + + void CleanupFFTThreads() + { + std::cout << "Start cleanup threads" << std::endl; // This is a trick to make sure fftw will cleanup its threads when application // shared lib is released. #if defined(ITK_USE_FFTWF) + std::cout << "ITK_USE_FFTWF" << std::endl; fftwf_cleanup_threads(); fftwf_cleanup(); #endif #if defined(ITK_USE_FFTWD) + std::cout << "ITK_USE_FFTWD" << std::endl; fftw_cleanup_threads(); fftw_cleanup(); #endif - } + std::cout << "End cleanup threads" << std::endl; + } void DoInit() ITK_OVERRIDE { @@ -252,9 +262,10 @@ private: // fft ttransform bool shift = IsParameterEnabled( "mode.fft.shift"); typedef otb::Image< std::complex<OutputPixelType> > ComplexOutputImageType; - + if (dir == 0 ) { + otbAppLogINFO( << "Forward FFT" ); //forward fft typedef otb::Image<InputPixelType> TInputImage; typedef TInputImage::Pointer TInputImagePointer; @@ -268,7 +279,7 @@ private: FFTFilter::Pointer fwdFilter = FFTFilter::New(); fwdFilter->SetInput( inImage ); - + //typedef VectorImage for output of UnaryFunctorImageFilter typedef otb::VectorImage<OutputPixelType> TOutputImage; @@ -276,7 +287,7 @@ private: ComplexOutputImageType, TOutputImage > ComplexToVectorImageCastFilter; ComplexToVectorImageCastFilter::Pointer unaryFunctorImageFilter = ComplexToVectorImageCastFilter::New(); - + if( shift) { otbAppLogINFO( << "Applying Shift image filter" ); @@ -304,6 +315,7 @@ private: } else { + otbAppLogINFO( << "Inverse FFT" ); //inverse fft typedef otb::VectorImage<InputPixelType> TInputImage; typedef TInputImage::Pointer TInputImagePointer; @@ -316,7 +328,7 @@ private: std::complex<InputPixelType>, 2 > TComplexImage; //typedef TOutputImage for InverseFFTImageFilter output typedef otb::Image< OutputPixelType > TOutputImage; - + // a unary functor to convert vectorimage to complex image typedef itk::UnaryFunctorImageFilter <TInputImage, @@ -330,6 +342,7 @@ private: if( shift) { + otbAppLogINFO( << "Applying Shift image filter" ); typedef itk::FFTShiftImageFilter< TInputImage, TInputImage > FFTShiftFilterType; diff --git a/Modules/Applications/AppDomainTransform/test/CMakeLists.txt b/Modules/Applications/AppDomainTransform/test/CMakeLists.txt index e397c71378b543164a511cef1b67c313f7f95bb8..f5bb2c2e30d2f8db030057dc8c08ec0ca86a2516 100644 --- a/Modules/Applications/AppDomainTransform/test/CMakeLists.txt +++ b/Modules/Applications/AppDomainTransform/test/CMakeLists.txt @@ -26,13 +26,29 @@ otb_test_application(NAME apTvDomainTransform_fft_shift_fwd -dir fwd -out ${TEMP}/apTvDomainTransform_fft_shift_fwd.tif ) - -otb_test_application(NAME apTvDomainTransform_fft_inv +otb_test_application(NAME apTvDomainTransform_fft_fwd + APP DomainTransform + OPTIONS -in ${INPUTDATA}/QB_Toulouse_Ortho_PAN.tif + -mode fft + -dir fwd + -out ${TEMP}/apTvDomainTransform_fft_fwd.tif + ) + +otb_test_application(NAME apTvDomainTransform_fft_shift_inv APP DomainTransform OPTIONS -in ${INPUTDATA}/QB_Toulouse_Ortho_PAN.tif -mode fft + -mode.fft.shift true -dir inv -out ${TEMP}/apTvDomainTransform_fft_shift_inv.tif ) + +otb_test_application(NAME apTvDomainTransform_fft_inv + APP DomainTransform + OPTIONS -in ${INPUTDATA}/QB_Toulouse_Ortho_PAN.tif + -mode fft + -dir inv + -out ${TEMP}/apTvDomainTransform_fft_inv.tif + ) diff --git a/Modules/MPI/MPIConfig/src/otbMPIConfig.cxx b/Modules/MPI/MPIConfig/src/otbMPIConfig.cxx index c582dc322fd9a5e5866e67562b568f8d94e9b538..5422797b1b4a91d51fe78d89f9bfa17b92039951 100644 --- a/Modules/MPI/MPIConfig/src/otbMPIConfig.cxx +++ b/Modules/MPI/MPIConfig/src/otbMPIConfig.cxx @@ -77,7 +77,7 @@ MPIConfig::Pointer MPIConfig::Instance() /** CreateInitialize MPI environment */ MPIConfig::MPIConfig() - : m_MyRank(-1), + : m_MyRank(0), m_NbProcs(0), m_abortOnException(true), m_initialized(false) @@ -95,12 +95,18 @@ MPIConfig::~MPIConfig() } else { + std::cout << "Start Finalize MPI" << std::endl; + std::flush(std::cout); int finalized; OTB_MPI_CHECK_RESULT(MPI_Finalized,(&finalized)); if (!finalized) { + std::cout << "Start 2nd End Finalize MPI" << std::endl; OTB_MPI_CHECK_RESULT(MPI_Finalize,()); + std::cout << "End 2nd Finalize MPI" << std::endl; } + std::cout << "End Finalize MPI" << std::endl; + std::flush(std::cout); } } }