From 027be94cf01334395a3ea49fb87eeca86e4a9712 Mon Sep 17 00:00:00 2001
From: berenger-bramas <berenger-bramas@2616d619-271b-44dc-8df4-d4a8f33a7222>
Date: Thu, 12 May 2011 07:53:23 +0000
Subject: [PATCH] Add a debug mode in cmake clean/refactor tests

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@85 2616d619-271b-44dc-8df4-d4a8f33a7222
---
 CMakeLists.txt                       | 7 +++++++
 Src/Core/FFmmAlgorithmThread.hpp     | 2 +-
 Src/Core/FFmmAlgorithmThreadProc.hpp | 2 +-
 Tests/testFmbAlgorithm.cpp           | 5 +----
 Tests/testFmbAlgorithmProc.cpp       | 1 +
 5 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6446360a5..e510a99d3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,7 @@ OPTION( SCALFMM_USE_CBLAS "Set to ON to build ScaFMM with BLAS" ON )
 OPTION( SCALFMM_USE_MPI "Set to ON to build ScaFMM with MPI" ON )
 OPTION( SCALFMM_BUILD_TESTS "Set to ON to build fonctionnalities Tests" ON )
 OPTION( SCALFMM_BUILD_UTESTS "Set to ON to build UTests" ON )
+OPTION( SCALFMM_BUILD_DEBUG "Set to ON to build in Debug" OFF )
 
 # MPI option has to be set before project
 if( SCALFMM_USE_MPI )
@@ -20,6 +21,12 @@ endif()
 # Project Infos
 project(scalfmm CXX)
 
+# Debug
+MESSAGE( STATUS "SCALFMM_BUILD_DEBUG = ${SCALFMM_BUILD_DEBUG}" )
+if( SCALFMM_BUILD_DEBUG )
+  SET(CMAKE_BUILD_TYPE Debug)
+endif()
+
 # Blas option
 if( SCALFMM_USE_CBLAS )
   OPTION( SCALFMM_USE_MKL_AS_BLAS "Set to ON to use MKL CBLAS" OFF )
diff --git a/Src/Core/FFmmAlgorithmThread.hpp b/Src/Core/FFmmAlgorithmThread.hpp
index 7ba8830e4..314eba613 100644
--- a/Src/Core/FFmmAlgorithmThread.hpp
+++ b/Src/Core/FFmmAlgorithmThread.hpp
@@ -64,7 +64,7 @@ public:
             this->kernels[idxThread] = new KernelClass<ParticleClass, CellClass, OctreeHeight>(*inKernels);
         }
 
-        FDEBUG(FDebug::Controller << "FFmmAlgorithmThread\n");
+        FDEBUG(FDebug::Controller << "FFmmAlgorithmThread (Max Thread " << omp_get_max_threads() << ")\n");
     }
 
     /** Default destructor */
diff --git a/Src/Core/FFmmAlgorithmThreadProc.hpp b/Src/Core/FFmmAlgorithmThreadProc.hpp
index d6264b8de..1af5557be 100644
--- a/Src/Core/FFmmAlgorithmThreadProc.hpp
+++ b/Src/Core/FFmmAlgorithmThreadProc.hpp
@@ -100,7 +100,7 @@ public:
         this->sendBuffer = new FBufferVector<BufferSize>[nbProcess];
 
         FDEBUG(FDebug::Controller << "FFmmAlgorithmThreadProc\n");
-        FDEBUG(FDebug::Controller << "Max threads = "  << MaxThreads << " .\n");
+        FDEBUG(FDebug::Controller << "Max threads = "  << MaxThreads << ", Procs = " << app.processCount() << ".\n");
     }
 
     /** Default destructor */
diff --git a/Tests/testFmbAlgorithm.cpp b/Tests/testFmbAlgorithm.cpp
index 75848d6d8..b03c8ef33 100644
--- a/Tests/testFmbAlgorithm.cpp
+++ b/Tests/testFmbAlgorithm.cpp
@@ -116,15 +116,12 @@ int main(int argc, char ** argv){
 
     FFmbKernels<FmbParticle, FmbCell, NbLevels> kernels(loader.getBoxWidth());
     //FFmmAlgorithm FFmmAlgorithmThreaded FFmmAlgorithmThread FFmmAlgorithmTask FFmmAlgorithmThreadUs
-    FFmmAlgorithm<FFmbKernels, FmbParticle, FmbCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
+    FFmmAlgorithmThread<FFmbKernels, FmbParticle, FmbCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
     algo.execute();
 
     counter.tac();
     std::cout << "Done  " << "(" << counter.elapsed() << "s)." << std::endl;
 
-    //std::cout << "Foces Sum  x = " << kernels.getForcesSum().getX() << " y = " << kernels.getForcesSum().getY() << " z = " << kernels.getForcesSum().getZ() << std::endl;
-    //std::cout << "Potential = " << kernels.getPotential() << std::endl;
-
     { // get sum forces&potential
         FReal potential = 0;
         F3DPosition forces;
diff --git a/Tests/testFmbAlgorithmProc.cpp b/Tests/testFmbAlgorithmProc.cpp
index b777a4c6f..f383c7162 100644
--- a/Tests/testFmbAlgorithmProc.cpp
+++ b/Tests/testFmbAlgorithmProc.cpp
@@ -29,6 +29,7 @@
 #include "../Src/Files/FFmaLoader.hpp"
 
 
+
 //#define VALIDATE_FMM
 
 // With openmp : g++ testFmbAlgorithm.cpp ../Src/Utils/FAssertable.cpp ../Src/Utils/FDebug.cpp ../Src/Utils/FTrace.cpp -lgomp -fopenmp -O2 -o testFmbAlgorithm.exe
-- 
GitLab