diff --git a/CMakeLists.txt b/CMakeLists.txt index 11f65dab8083d5902110d83aeeee614d992a68ea..bb1b8f09baae1da2a391486493c76019be951b0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ if(insource) endif(insource) # Options -OPTION( SCALFMM_USE_CBLAS "Set to ON to build ScaFMM with BLAS" ON ) +OPTION( SCALFMM_USE_CBLAS "Set to ON to build ScaFMM with BLAS" OFF ) OPTION( SCALFMM_USE_MPI "Set to ON to build ScaFMM with MPI" ON ) OPTION( SCALFMM_USE_TRACE "Set to ON to print trace or use itac trace" OFF ) OPTION( SCALFMM_BUILD_TESTS "Set to ON to build fonctionnalities Tests" ON ) diff --git a/Src/Core/FFmmAlgorithmThread.hpp b/Src/Core/FFmmAlgorithmThread.hpp index 85dccd6a7e8374cc3add8e04b867a3dca5ad11c9..dbfa58252aef09c17745e0a5cca80cecb4951814 100644 --- a/Src/Core/FFmmAlgorithmThread.hpp +++ b/Src/Core/FFmmAlgorithmThread.hpp @@ -298,10 +298,8 @@ private: FDEBUG(FTic computationCounter); FDEBUG(FTic computationCounterP2P); - int countShape[SizeShape]; omp_lock_t lockShape[SizeShape]; for(int idxShape = 0 ; idxShape < SizeShape ; ++idxShape){ - countShape[idxShape] = 0; omp_init_lock(&lockShape[idxShape]); } diff --git a/Src/Files/FMpiTreeBuilder.hpp b/Src/Files/FMpiTreeBuilder.hpp index 564c56c54c93f917f68848c9510add32b53c54a1..25a428404fe33dd55c26bd541c9d58af27cdf6ca 100644 --- a/Src/Files/FMpiTreeBuilder.hpp +++ b/Src/Files/FMpiTreeBuilder.hpp @@ -302,7 +302,6 @@ private: // I need to send right if I hold leaves that belong to procs on my right const bool iNeedToSendToRight = correctRightLeavesIndex < currentLeafsOnMyLeft + currentNbLeafs; - int leftProcToStartSend = rank; if(iNeedToSendToLeft){ FTRACE( FTrace::FRegion regionTrace("Calcul SendToLeft", __FUNCTION__ , __FILE__ , __LINE__) ); // Find the first proc that need my data @@ -317,7 +316,6 @@ private: } // Count data for this proc - leftProcToStartSend = idxProc; int ICanGive = int(currentNbLeafs); leavesToSend[idxProc] = int(FMath::Min(communicator.getOtherRight(totalNbLeaves, idxProc), totalNbLeaves - currentLeafsOnMyRight) - FMath::Max( currentLeafsOnMyLeft , communicator.getOtherLeft(totalNbLeaves, idxProc))); diff --git a/Src/Fmb/FFmbKernels.hpp b/Src/Fmb/FFmbKernels.hpp index 75ebc0a92ff360db2a4bd679bf385d78a31b8e0d..2e7baae9ad36cbfce4e603c651c053a68242212b 100644 --- a/Src/Fmb/FFmbKernels.hpp +++ b/Src/Fmb/FFmbKernels.hpp @@ -47,7 +47,7 @@ protected: // Can be FMB_Info_P if user ask to -- if FMB_Info.up_to_P_in_M2L it true static const int FMB_Info_M2L_P = FMB_Info_up_to_P_in_M2L? FMB_Info_P : 2 * FMB_Info_P; - static const int FMB_Info_M2L_exp_size = ((FMB_Info_M2L_P)+1) * ((FMB_Info_M2L_P)+2) * 0.5; + static const int FMB_Info_M2L_exp_size = int(((FMB_Info_M2L_P)+1) * ((FMB_Info_M2L_P)+2) * 0.5); // Default value set in main static const int FMB_Info_ws = 1; @@ -58,7 +58,7 @@ protected: static const int halphSize1Dim = (2*(FMB_Info_ws)+1); // EXPANSION_SIZE(FMB_Info.P) - static const int FMB_Info_exp_size = ((FMB_Info_P)+1) * ((FMB_Info_P)+2) * 0.5; + static const int FMB_Info_exp_size = int(((FMB_Info_P)+1) * ((FMB_Info_P)+2) * 0.5); // NEXP_SIZE(FMB_Info.P) static const int FMB_Info_nexp_size = (FMB_Info_P + 1) * (FMB_Info_P + 1); @@ -1226,9 +1226,9 @@ public: if (th < -M_PI + FMath::Epsilon) th += 2 * FMath::Epsilon; } //spherical_position_Set_r - FReal rh = spherical.r; + //FReal rh = spherical.r; if (spherical.r < 0){ - rh = -spherical.r; + //rh = -spherical.r; //spherical_position_Set_ph(p, M_PI - spherical_position_Get_th(p)); ph = FMath::Fmod(FMath::FPi - th, 2*FMath::FPi); if (ph > M_PI) ph -= 2*FMath::FPi; diff --git a/Src/Fmb/FFmbKernelsBlas.hpp b/Src/Fmb/FFmbKernelsBlas.hpp index c36a08d93973d69b82d2f2829e2b1ee965ae9b0a..9dad6dbdc5d63e749aa51f896290f3f6d326229e 100644 --- a/Src/Fmb/FFmbKernelsBlas.hpp +++ b/Src/Fmb/FFmbKernelsBlas.hpp @@ -46,7 +46,7 @@ protected: // Can be FMB_Info_P if user ask to -- if FMB_Info.up_to_P_in_M2L it true static const int FMB_Info_M2L_P = FMB_Info_up_to_P_in_M2L? FMB_Info_P : 2 * FMB_Info_P; - static const int FMB_Info_M2L_exp_size = ((FMB_Info_M2L_P)+1) * ((FMB_Info_M2L_P)+2) * 0.5; + static const int FMB_Info_M2L_exp_size = int(((FMB_Info_M2L_P)+1) * ((FMB_Info_M2L_P)+2) * 0.5); // Default value set in main static const int FMB_Info_ws = 1; @@ -57,7 +57,7 @@ protected: static const int halphSize1Dim = (2*(FMB_Info_ws)+1); // EXPANSION_SIZE(FMB_Info.P) - static const int FMB_Info_exp_size = ((FMB_Info_P)+1) * ((FMB_Info_P)+2) * 0.5; + static const int FMB_Info_exp_size = int(((FMB_Info_P)+1) * ((FMB_Info_P)+2) * 0.5); // NEXP_SIZE(FMB_Info.P) static const int FMB_Info_nexp_size = (FMB_Info_P + 1) * (FMB_Info_P + 1); diff --git a/Src/Fmb/FFmbKernelsBlockBlas.hpp b/Src/Fmb/FFmbKernelsBlockBlas.hpp index 7cd96a608e8136bb02e1e6fc2492dfc4c303b2c3..95b821fd80c0c5c7bc5033cbebbc4960d2488e35 100644 --- a/Src/Fmb/FFmbKernelsBlockBlas.hpp +++ b/Src/Fmb/FFmbKernelsBlockBlas.hpp @@ -46,7 +46,7 @@ protected: // Can be FMB_Info_P if user ask to -- if FMB_Info.up_to_P_in_M2L it true static const int FMB_Info_M2L_P = FMB_Info_up_to_P_in_M2L? FMB_Info_P : 2 * FMB_Info_P; - static const int FMB_Info_M2L_exp_size = ((FMB_Info_M2L_P)+1) * ((FMB_Info_M2L_P)+2) * 0.5; + static const int FMB_Info_M2L_exp_size = int(((FMB_Info_M2L_P)+1) * ((FMB_Info_M2L_P)+2) * 0.5); // Default value set in main static const int FMB_Info_ws = 1; @@ -57,7 +57,7 @@ protected: static const int halphSize1Dim = (2*(FMB_Info_ws)+1); // EXPANSION_SIZE(FMB_Info.P) - static const int FMB_Info_exp_size = ((FMB_Info_P)+1) * ((FMB_Info_P)+2) * 0.5; + static const int FMB_Info_exp_size = int(((FMB_Info_P)+1) * ((FMB_Info_P)+2) * 0.5); // NEXP_SIZE(FMB_Info.P) static const int FMB_Info_nexp_size = (FMB_Info_P + 1) * (FMB_Info_P + 1); @@ -1514,9 +1514,9 @@ public: if (th < -M_PI + FMath::Epsilon) th += 2 * FMath::Epsilon; } //spherical_position_Set_r - FReal rh = spherical.r; + //FReal rh = spherical.r; if (spherical.r < 0){ - rh = -spherical.r; + //rh = -spherical.r; //spherical_position_Set_ph(p, M_PI - spherical_position_Get_th(p)); ph = FMath::Fmod(FMath::FPi - th, 2*FMath::FPi); if (ph > M_PI) ph -= 2*FMath::FPi; diff --git a/Src/Utils/FBlas.hpp b/Src/Utils/FBlas.hpp index df7beaf8d4afe2a0658e5cb3ba6efc5a0402f775..3a5c1243d2c8f688b736606d949d1759f357ce1a 100644 --- a/Src/Utils/FBlas.hpp +++ b/Src/Utils/FBlas.hpp @@ -11,67 +11,87 @@ #include "FGlobal.hpp" -#ifdef SCALFMM_USE_MKL_AS_BLAS -#include <mkl_cblas.h> -#else -#include <cblas.h> -#endif +#ifdef SCALFMM_USE_CBLAS -/////////////////////////////////////////////////////// -// GEMV -/////////////////////////////////////////////////////// + #ifdef SCALFMM_USE_MKL_AS_BLAS + #include <mkl_cblas.h> + #else + #include <cblas.h> + #endif -template <typename T> -void cblas_gemv(const CBLAS_ORDER order , - const CBLAS_TRANSPOSE TransA , const int M , const int N , - const void *alpha , const void *A , const int lda , - const void *X , const int incX , const void *beta , - void *Y , const int incY){ - T t; - t.you_cannot_use_this_function_with_this_type(); -} - -template <> -void cblas_gemv<double>(const CBLAS_ORDER order , - const CBLAS_TRANSPOSE TransA , const int M , const int N , - const void *alpha , const void *A , const int lda , - const void *X , const int incX , const void *beta , - void *Y , const int incY){ - cblas_zgemv(order,TransA,M,N,alpha,A,lda,X,incX,beta,Y,incY); -} - -template <> -void cblas_gemv<float>(const CBLAS_ORDER order , - const CBLAS_TRANSPOSE TransA , const int M , const int N , - const void *alpha , const void *A , const int lda , - const void *X , const int incX , const void *beta , - void *Y , const int incY){ - cblas_cgemv(order,TransA,M,N,alpha,A,lda,X,incX,beta,Y,incY); -} + /////////////////////////////////////////////////////// + // GEMV + /////////////////////////////////////////////////////// + template <typename T> + void cblas_gemv(const CBLAS_ORDER order , + const CBLAS_TRANSPOSE TransA , const int M , const int N , + const void *alpha , const void *A , const int lda , + const void *X , const int incX , const void *beta , + void *Y , const int incY){ + T t; + t.you_cannot_use_this_function_with_this_type(); + } -/////////////////////////////////////////////////////// -// Dotu -/////////////////////////////////////////////////////// + template <> + void cblas_gemv<double>(const CBLAS_ORDER order , + const CBLAS_TRANSPOSE TransA , const int M , const int N , + const void *alpha , const void *A , const int lda , + const void *X , const int incX , const void *beta , + void *Y , const int incY){ + cblas_zgemv(order,TransA,M,N,alpha,A,lda,X,incX,beta,Y,incY); + } + + template <> + void cblas_gemv<float>(const CBLAS_ORDER order , + const CBLAS_TRANSPOSE TransA , const int M , const int N , + const void *alpha , const void *A , const int lda , + const void *X , const int incX , const void *beta , + void *Y , const int incY){ + cblas_cgemv(order,TransA,M,N,alpha,A,lda,X,incX,beta,Y,incY); + } + + + /////////////////////////////////////////////////////// + // Dotu + /////////////////////////////////////////////////////// + + template <typename T> + void cblas_dotu_sub( const int N , const void *X , const int incX , + const void *Y , const int incY , void *dotu){ + T t; + t.you_cannot_use_this_function_with_this_type(); + } + + template <> + void cblas_dotu_sub<double>(const int N , const void *X , const int incX , + const void *Y , const int incY , void *dotu){ + cblas_zdotu_sub(N,X,incX,Y,incY,dotu); + } + + template <> + void cblas_dotu_sub<float>(const int N , const void *X , const int incX , + const void *Y , const int incY , void *dotu){ + cblas_cdotu_sub(N,X,incX,Y,incY,dotu); + } + +#else + enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102}; + enum CBLAS_TRANSPOSE {CblasNoTrans, CblasTrans, CblasConjTrans}; + + template <typename T> + void cblas_gemv(const CBLAS_ORDER order , + const CBLAS_TRANSPOSE TransA , const int M , const int N , + const void *alpha , const void *A , const int lda , + const void *X , const int incX , const void *beta , + void *Y , const int incY){ + } + template <typename T> + void cblas_dotu_sub( const int N , const void *X , const int incX , + const void *Y , const int incY , void *dotu){ + } -template <typename T> -void cblas_dotu_sub( const int N , const void *X , const int incX , - const void *Y , const int incY , void *dotu){ - T t; - t.you_cannot_use_this_function_with_this_type(); -} - -template <> -void cblas_dotu_sub<double>(const int N , const void *X , const int incX , - const void *Y , const int incY , void *dotu){ - cblas_zdotu_sub(N,X,incX,Y,incY,dotu); -} - -template <> -void cblas_dotu_sub<float>(const int N , const void *X , const int incX , - const void *Y , const int incY , void *dotu){ - cblas_cdotu_sub(N,X,incX,Y,incY,dotu); -} +#endif //SCALFMM_USE_CBLAS #endif //FBLAS_HPP diff --git a/Src/Utils/FMemStats.h b/Src/Utils/FMemStats.h index 52a3da8e33ec9fb79ba9ad8c1bfa0be09890a837..8a48130413faa744679bef99ea2d341526c97028 100644 --- a/Src/Utils/FMemStats.h +++ b/Src/Utils/FMemStats.h @@ -5,7 +5,6 @@ #include <new> #include <stdexcept> #include <stdlib.h> -#include <cstdio> #ifdef SCALFMM_USE_MEM_STATS void* operator new(std::size_t n) throw(std::bad_alloc);