Loading CMakeLists.txt +12 −5 Original line number Diff line number Diff line Loading @@ -25,11 +25,11 @@ option(WITH_GMP "Build with GMP support" OFF) option(WITH_TESTS "Build tests" ON) option(WITH_PROFILING "Enable code profiling compiler flags" OFF ) option(WITH_COVERAGE "Enable code coverage reports from unit tests" OFF) option(WITH_EXAMPLES "Compile the 'examples' directory" ON) option(WITH_EXAMPLES "Compile the 'src/Examples' directory" ON) option(WITH_TOOLS "Compile the 'src/Tools' directory" ON) option(WITH_BENCHMARKS "Compile the 'src/Benchmarks' directory" ON) option(WITH_PYTHON "Compile the Python bindings" ON) option(WITH_DOC "Generate documentation" ON) option(WITH_DOC "Build examples included in the documentation" ON) # install paths relative to the cmake's prefix set( TNL_TARGET_INCLUDE_DIRECTORY "include/TNL" ) Loading Loading @@ -81,10 +81,10 @@ set( CMAKE_CXX_STANDARD 14 ) set( CMAKE_CXX_STANDARD_REQUIRED ON ) set( CMAKE_CXX_EXTENSIONS OFF ) # set Debug/Release options # set default build options set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wall -Wno-unused-local-typedefs -Wno-unused-variable -Wno-unknown-pragmas" ) set( CMAKE_CXX_FLAGS_DEBUG "-g" ) set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -mtune=native -DNDEBUG" ) set( CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" ) # pass -rdynamic only in Debug mode set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" ) set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_DEBUG "-rdynamic" ) Loading @@ -96,6 +96,13 @@ set( CMAKE_SHARED_LINKER_FLAGS "" ) set( CMAKE_SHARED_LINKER_FLAGS_DEBUG "-rdynamic" ) set( CMAKE_SHARED_LINKER_FLAGS_RELEASE "" ) # set additional Debug/Release options using generator expressions # (that way we can exclude some options for specific targets, see https://stackoverflow.com/a/59734798 for details) add_compile_options( # GOTCHA: CMake uses semicolons as list item separator, spaces would lead to a single argument inside double-quotes on the command line "$<$<CONFIG:RELEASE>:-march=native;-mtune=native>" ) # disable GCC's infamous "maybe-uninitialized" warning (it produces mostly false positives) if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized" ) Loading Loading @@ -300,7 +307,7 @@ add_subdirectory( src ) add_subdirectory( share ) # Add subdirectories for examples included in the documentation if( ${WITH_DOC} OR ${WITH_EXAMPLES} ) if( ${WITH_DOC} ) set( TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH "${CMAKE_SOURCE_DIR}/Documentation/output_snippets" ) file(MAKE_DIRECTORY ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}) add_subdirectory( Documentation/Examples ) Loading build +2 −1 Original line number Diff line number Diff line Loading @@ -87,10 +87,11 @@ if [[ ${HELP} == "yes" ]]; then echo " --with-profiling=yes/no Enables code profiling compiler falgs. 'no' by default." echo " --with-coverage=yes/no Enables code coverage reports for unit tests. 'no' by default (lcov is required)." echo " --with-doc=yes/no Build documentation. 'yes' by default." echo " --with-examples=yes/no Compile the 'examples' directory. 'yes' by default." echo " --with-examples=yes/no Compile the 'src/Examples' directory. 'yes' by default." echo " --with-tools=yes/no Compile the 'src/Tools' directory. 'yes' by default." echo " --with-python=yes/no Compile the Python bindings. 'yes' by default." echo " --with-benchmarks=yes/no Compile the 'src/Benchmarks' directory. 'yes' by default." echo " --with-doc=yes/no Generate the documentation. 'yes' by default." echo " --cmake=CMAKE Path to cmake. 'cmake' by default." echo " --verbose It enables verbose build." echo " --root-dir=PATH Path to the TNL source code root dir." Loading src/Benchmarks/BLAS/CMakeLists.txt +18 −6 Original line number Diff line number Diff line Loading @@ -5,16 +5,28 @@ else() add_executable( tnl-benchmark-blas tnl-benchmark-blas.cpp ) endif() find_library( CBLAS_LIBRARY NAMES cblas PATHS /usr/lib /usr/lib64 /usr/lib/x86_64-linux-gnu /usr/local/lib /usr/local/lib64 ) find_library( CBLAS_LIBRARY NAMES cblas ) # fallback for Centos 7.5 - libcblas.so does not exist, link to libtatlas.so or libsatlas.so # https://forums.centos.org/viewtopic.php?t=48543 find_library( TATLAS_LIBRARY NAMES tatlas PATH_SUFFIXES atlas ) find_library( SATLAS_LIBRARY NAMES satlas PATH_SUFFIXES atlas ) if( CBLAS_LIBRARY ) target_compile_definitions( tnl-benchmark-blas PUBLIC "-DHAVE_BLAS" ) target_link_libraries( tnl-benchmark-blas ${CBLAS_LIBRARY} ) elseif( TATLAS_LIBRARY ) target_compile_definitions( tnl-benchmark-blas PUBLIC "-DHAVE_BLAS" ) target_link_libraries( tnl-benchmark-blas ${TATLAS_LIBRARY} ) elseif( SATLAS_LIBRARY ) target_compile_definitions( tnl-benchmark-blas PUBLIC "-DHAVE_BLAS" ) target_link_libraries( tnl-benchmark-blas ${SATLAS_LIBRARY} ) else() # FIXME: We require the CBLAS interface, but CMake's FindBLAS cannot detect that, # so this fails unless the BLAS implementation includes it in the same # shared library file as the Fortran implementation (e.g. OpenBLAS does that). find_package( BLAS ) if( BLAS_FOUND ) target_compile_definitions( tnl-benchmark-blas PUBLIC "-DHAVE_BLAS" ) Loading src/Benchmarks/BLAS/blasWrappers.h +6 −0 Original line number Diff line number Diff line Loading @@ -2,7 +2,13 @@ #ifdef HAVE_BLAS // HOTFIX: cblas.h from the atlas-devel package (version 3.10.1-12.el7) on CentOS 7 // does not declare the functions as `extern "C"`, which breaks name mangling. // Note that nested `extern "C"` is valid and correct: // https://stackoverflow.com/questions/48099828/what-happens-if-you-nest-extern-c extern "C" { #include <cblas.h> } inline int blasIgamax( int n, const float *x, int incx ) { Loading src/Benchmarks/LinearSolvers/benchmarks.h +2 −2 Original line number Diff line number Diff line Loading @@ -145,7 +145,7 @@ benchmarkSolver( Benchmark& benchmark, virtual HeaderElements getTableHeader() const override { return HeaderElements({"time", "speedup", "converged", "iterations", "residue_precond", "residue_true"}); return HeaderElements({"time", "stddev", "stddev/time", "speedup", "converged", "iterations", "residue_precond", "residue_true"}); } virtual RowElements getRowElements() const override Loading @@ -160,7 +160,7 @@ benchmarkSolver( Benchmark& benchmark, r = b - r; const double residue_true = lpNorm( r, 2.0 ) / lpNorm( b, 2.0 ); return RowElements({ time, speedup, (double) converged, (double) iterations, return RowElements({ time, stddev, stddev/time, speedup, (double) converged, (double) iterations, residue_precond, residue_true }); } }; Loading Loading
CMakeLists.txt +12 −5 Original line number Diff line number Diff line Loading @@ -25,11 +25,11 @@ option(WITH_GMP "Build with GMP support" OFF) option(WITH_TESTS "Build tests" ON) option(WITH_PROFILING "Enable code profiling compiler flags" OFF ) option(WITH_COVERAGE "Enable code coverage reports from unit tests" OFF) option(WITH_EXAMPLES "Compile the 'examples' directory" ON) option(WITH_EXAMPLES "Compile the 'src/Examples' directory" ON) option(WITH_TOOLS "Compile the 'src/Tools' directory" ON) option(WITH_BENCHMARKS "Compile the 'src/Benchmarks' directory" ON) option(WITH_PYTHON "Compile the Python bindings" ON) option(WITH_DOC "Generate documentation" ON) option(WITH_DOC "Build examples included in the documentation" ON) # install paths relative to the cmake's prefix set( TNL_TARGET_INCLUDE_DIRECTORY "include/TNL" ) Loading Loading @@ -81,10 +81,10 @@ set( CMAKE_CXX_STANDARD 14 ) set( CMAKE_CXX_STANDARD_REQUIRED ON ) set( CMAKE_CXX_EXTENSIONS OFF ) # set Debug/Release options # set default build options set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wall -Wno-unused-local-typedefs -Wno-unused-variable -Wno-unknown-pragmas" ) set( CMAKE_CXX_FLAGS_DEBUG "-g" ) set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -mtune=native -DNDEBUG" ) set( CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" ) # pass -rdynamic only in Debug mode set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" ) set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_DEBUG "-rdynamic" ) Loading @@ -96,6 +96,13 @@ set( CMAKE_SHARED_LINKER_FLAGS "" ) set( CMAKE_SHARED_LINKER_FLAGS_DEBUG "-rdynamic" ) set( CMAKE_SHARED_LINKER_FLAGS_RELEASE "" ) # set additional Debug/Release options using generator expressions # (that way we can exclude some options for specific targets, see https://stackoverflow.com/a/59734798 for details) add_compile_options( # GOTCHA: CMake uses semicolons as list item separator, spaces would lead to a single argument inside double-quotes on the command line "$<$<CONFIG:RELEASE>:-march=native;-mtune=native>" ) # disable GCC's infamous "maybe-uninitialized" warning (it produces mostly false positives) if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized" ) Loading Loading @@ -300,7 +307,7 @@ add_subdirectory( src ) add_subdirectory( share ) # Add subdirectories for examples included in the documentation if( ${WITH_DOC} OR ${WITH_EXAMPLES} ) if( ${WITH_DOC} ) set( TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH "${CMAKE_SOURCE_DIR}/Documentation/output_snippets" ) file(MAKE_DIRECTORY ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}) add_subdirectory( Documentation/Examples ) Loading
build +2 −1 Original line number Diff line number Diff line Loading @@ -87,10 +87,11 @@ if [[ ${HELP} == "yes" ]]; then echo " --with-profiling=yes/no Enables code profiling compiler falgs. 'no' by default." echo " --with-coverage=yes/no Enables code coverage reports for unit tests. 'no' by default (lcov is required)." echo " --with-doc=yes/no Build documentation. 'yes' by default." echo " --with-examples=yes/no Compile the 'examples' directory. 'yes' by default." echo " --with-examples=yes/no Compile the 'src/Examples' directory. 'yes' by default." echo " --with-tools=yes/no Compile the 'src/Tools' directory. 'yes' by default." echo " --with-python=yes/no Compile the Python bindings. 'yes' by default." echo " --with-benchmarks=yes/no Compile the 'src/Benchmarks' directory. 'yes' by default." echo " --with-doc=yes/no Generate the documentation. 'yes' by default." echo " --cmake=CMAKE Path to cmake. 'cmake' by default." echo " --verbose It enables verbose build." echo " --root-dir=PATH Path to the TNL source code root dir." Loading
src/Benchmarks/BLAS/CMakeLists.txt +18 −6 Original line number Diff line number Diff line Loading @@ -5,16 +5,28 @@ else() add_executable( tnl-benchmark-blas tnl-benchmark-blas.cpp ) endif() find_library( CBLAS_LIBRARY NAMES cblas PATHS /usr/lib /usr/lib64 /usr/lib/x86_64-linux-gnu /usr/local/lib /usr/local/lib64 ) find_library( CBLAS_LIBRARY NAMES cblas ) # fallback for Centos 7.5 - libcblas.so does not exist, link to libtatlas.so or libsatlas.so # https://forums.centos.org/viewtopic.php?t=48543 find_library( TATLAS_LIBRARY NAMES tatlas PATH_SUFFIXES atlas ) find_library( SATLAS_LIBRARY NAMES satlas PATH_SUFFIXES atlas ) if( CBLAS_LIBRARY ) target_compile_definitions( tnl-benchmark-blas PUBLIC "-DHAVE_BLAS" ) target_link_libraries( tnl-benchmark-blas ${CBLAS_LIBRARY} ) elseif( TATLAS_LIBRARY ) target_compile_definitions( tnl-benchmark-blas PUBLIC "-DHAVE_BLAS" ) target_link_libraries( tnl-benchmark-blas ${TATLAS_LIBRARY} ) elseif( SATLAS_LIBRARY ) target_compile_definitions( tnl-benchmark-blas PUBLIC "-DHAVE_BLAS" ) target_link_libraries( tnl-benchmark-blas ${SATLAS_LIBRARY} ) else() # FIXME: We require the CBLAS interface, but CMake's FindBLAS cannot detect that, # so this fails unless the BLAS implementation includes it in the same # shared library file as the Fortran implementation (e.g. OpenBLAS does that). find_package( BLAS ) if( BLAS_FOUND ) target_compile_definitions( tnl-benchmark-blas PUBLIC "-DHAVE_BLAS" ) Loading
src/Benchmarks/BLAS/blasWrappers.h +6 −0 Original line number Diff line number Diff line Loading @@ -2,7 +2,13 @@ #ifdef HAVE_BLAS // HOTFIX: cblas.h from the atlas-devel package (version 3.10.1-12.el7) on CentOS 7 // does not declare the functions as `extern "C"`, which breaks name mangling. // Note that nested `extern "C"` is valid and correct: // https://stackoverflow.com/questions/48099828/what-happens-if-you-nest-extern-c extern "C" { #include <cblas.h> } inline int blasIgamax( int n, const float *x, int incx ) { Loading
src/Benchmarks/LinearSolvers/benchmarks.h +2 −2 Original line number Diff line number Diff line Loading @@ -145,7 +145,7 @@ benchmarkSolver( Benchmark& benchmark, virtual HeaderElements getTableHeader() const override { return HeaderElements({"time", "speedup", "converged", "iterations", "residue_precond", "residue_true"}); return HeaderElements({"time", "stddev", "stddev/time", "speedup", "converged", "iterations", "residue_precond", "residue_true"}); } virtual RowElements getRowElements() const override Loading @@ -160,7 +160,7 @@ benchmarkSolver( Benchmark& benchmark, r = b - r; const double residue_true = lpNorm( r, 2.0 ) / lpNorm( b, 2.0 ); return RowElements({ time, speedup, (double) converged, (double) iterations, return RowElements({ time, stddev, stddev/time, speedup, (double) converged, (double) iterations, residue_precond, residue_true }); } }; Loading