Commit a991bebc authored by COULAUD Olivier's avatar COULAUD Olivier

Add CMAKE_CXX_STANDARD, fix some issues detected by sonarQube

parent 26e3813d
...@@ -13,7 +13,6 @@ set(FUSE_LIST " MPI;BLAS;FFT;STARPU;CUDA;OPENCL;OMP4;SSE;AVX;AVX2;MIC;MPI2") ...@@ -13,7 +13,6 @@ set(FUSE_LIST " MPI;BLAS;FFT;STARPU;CUDA;OPENCL;OMP4;SSE;AVX;AVX2;MIC;MPI2")
# Project Declaration # Project Declaration
#=========================================================================== #===========================================================================
project(SCALFMM C CXX ) project(SCALFMM C CXX )
# check if compiling into source directories # check if compiling into source directories
string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" insource) string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" insource)
if(insource) if(insource)
...@@ -28,7 +27,7 @@ INCLUDE(CMakeDependentOption) ...@@ -28,7 +27,7 @@ INCLUDE(CMakeDependentOption)
# Add to check CPU info # Add to check CPU info
include(GetCpuInfos) include(GetCpuInfos)
GetCpuInfos() GetCpuInfos()
#
#=========================================================================== #===========================================================================
# Version Number # Version Number
#=========================================================================== #===========================================================================
...@@ -39,6 +38,10 @@ set(SCALFMM_MINOR_VERSION 0) ...@@ -39,6 +38,10 @@ set(SCALFMM_MINOR_VERSION 0)
set(SCALFMM_PATCH_VERSION rc0) set(SCALFMM_PATCH_VERSION rc0)
set(SCALFMM_VERSION "${SCALFMM_MAJOR_VERSION}.${SCALFMM_MINOR_VERSION}.${SCALFMM_PATCH_VERSION}" ) set(SCALFMM_VERSION "${SCALFMM_MAJOR_VERSION}.${SCALFMM_MINOR_VERSION}.${SCALFMM_PATCH_VERSION}" )
SET(CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_STANDARD 14)
set( MORSE_DISTRIB_DIR "" CACHE PATH "Directory of MORSE distribution") set( MORSE_DISTRIB_DIR "" CACHE PATH "Directory of MORSE distribution")
if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/") if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/")
...@@ -140,7 +143,7 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/ ...@@ -140,7 +143,7 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
message(STATUS "CXX ${CMAKE_CXX_COMPILER_ID}" ) message(STATUS "CXX ${CMAKE_CXX_COMPILER_ID}" )
# Set scalfmm to default libraries # Set scalfmm to default libraries
set(SCALFMM_LIBRARIES "") set(SCALFMM_LIBRARIES "")
set(SCALFMM_CXX_FLAGS "-std=c++14 -fpic -Wall") set(SCALFMM_CXX_FLAGS "-fpic -Wall")
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/Contribs") set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/Contribs")
# #
# #
......
This diff is collapsed.
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
#include "FChebTensor.hpp" #include "FChebTensor.hpp"
#include "../Interpolation/FInterpSymmetries.hpp" #include "Kernels/Interpolation/FInterpSymmetries.hpp"
#include "Kernels/Interpolation/FInterpMatrixKernel.hpp"
#include "FChebM2LHandler.hpp" #include "FChebM2LHandler.hpp"
#include "Utils/FAca.hpp" #include "Utils/FAca.hpp"
...@@ -156,6 +156,10 @@ static void precompute(const MatrixKernelClass *const MatrixKernel, const FReal ...@@ -156,6 +156,10 @@ static void precompute(const MatrixKernelClass *const MatrixKernel, const FReal
if (INFO!=0){ if (INFO!=0){
std::stringstream stream; std::stringstream stream;
stream << INFO; stream << INFO;
delete [] U ;
delete [] WORK ;
delete [] VT ;
delete [] S ;
throw std::runtime_error("SVD did not converge with " + stream.str()); throw std::runtime_error("SVD did not converge with " + stream.str());
} }
rank = FSvd::getRank(S, aca_rank, Epsilon); rank = FSvd::getRank(S, aca_rank, Epsilon);
...@@ -348,7 +352,12 @@ public: ...@@ -348,7 +352,12 @@ public:
/** Destructor */ /** Destructor */
~SymmetryHandler() ~SymmetryHandler()
{ {
for (unsigned int t=0; t<343; ++t) if (K[t]!=nullptr) delete [] K[t]; for (unsigned int t=0; t<343; ++t){
if (K[t]!=nullptr){
delete [] K[t];
}
}
} }
...@@ -396,8 +405,10 @@ public: ...@@ -396,8 +405,10 @@ public:
// init all 343 item to zero, because effectively only 16 exist // init all 343 item to zero, because effectively only 16 exist
K = new FReal** [TreeHeight]; K = new FReal** [TreeHeight];
LowRank = new int* [TreeHeight]; LowRank = new int* [TreeHeight];
K[0] = nullptr; K[1] = nullptr; K[0] = nullptr;
LowRank[0] = nullptr; LowRank[1] = nullptr; K[1] = nullptr;
LowRank[0] = nullptr;
LowRank[1] = nullptr;
for (unsigned int l=2; l<TreeHeight; ++l) { for (unsigned int l=2; l<TreeHeight; ++l) {
K[l] = new FReal* [343]; K[l] = new FReal* [343];
LowRank[l] = new int [343]; LowRank[l] = new int [343];
...@@ -435,10 +446,17 @@ public: ...@@ -435,10 +446,17 @@ public:
{ {
for (unsigned int l=0; l<TreeHeight; ++l) { for (unsigned int l=0; l<TreeHeight; ++l) {
if (K[l]!=nullptr) { if (K[l]!=nullptr) {
for (unsigned int t=0; t<343; ++t) if (K[l][t]!=nullptr) delete [] K[l][t]; for (unsigned int t=0; t<343; ++t) {
if (K[l][t]!=nullptr){
delete [] K[l][t];
}
}
delete [] K[l]; delete [] K[l];
} }
if (LowRank[l]!=nullptr) delete [] LowRank[l]; if (LowRank[l]!=nullptr) {
delete [] LowRank[l];
}
} }
delete [] K; delete [] K;
delete [] LowRank; delete [] LowRank;
...@@ -476,7 +494,8 @@ static void ComputeAndCompressAndStoreInBinaryFile(const MatrixKernelClass *cons ...@@ -476,7 +494,8 @@ static void ComputeAndCompressAndStoreInBinaryFile(const MatrixKernelClass *cons
// compute and compress //////////// // compute and compress ////////////
FReal* K[343]; FReal* K[343];
int LowRank[343]; int LowRank[343];
for (unsigned int idx=0; idx<343; ++idx) { K[idx] = nullptr; LowRank[idx] = 0; } for (unsigned int idx=0; idx<343; ++idx)
{ K[idx] = nullptr; LowRank[idx] = 0; }
precompute<FReal,ORDER>(MatrixKernel, FReal(2.), Epsilon, K, LowRank); precompute<FReal,ORDER>(MatrixKernel, FReal(2.), Epsilon, K, LowRank);
// write to binary file //////////// // write to binary file ////////////
...@@ -510,7 +529,11 @@ static void ComputeAndCompressAndStoreInBinaryFile(const MatrixKernelClass *cons ...@@ -510,7 +529,11 @@ static void ComputeAndCompressAndStoreInBinaryFile(const MatrixKernelClass *cons
// << " in " << time.tacAndElapsed() << "sec." << std::endl; // << " in " << time.tacAndElapsed() << "sec." << std::endl;
// free memory ///////////////////// // free memory /////////////////////
for (unsigned int t=0; t<343; ++t) if (K[t]!=nullptr) delete [] K[t]; for (unsigned int t=0; t<343; ++t) {
if (K[t]!=nullptr) {
delete [] K[t];
}
}
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment