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 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