diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-09-01 12:41:09 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-09-01 12:41:09 +0100 |
commit | f031b11ddb8b74b82983b634fc910926ffc58600 (patch) | |
tree | 380c08da5067dda12332ca1b93bdc768bf8b38c0 /cmake | |
parent | edaf251d9e2e0a3e8ffc200c904dd6a90284442c (diff) | |
download | rspamd-f031b11ddb8b74b82983b634fc910926ffc58600.tar.gz rspamd-f031b11ddb8b74b82983b634fc910926ffc58600.zip |
[Minor] Use cblas_saxpy where possible
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Openblas.cmake | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cmake/Openblas.cmake b/cmake/Openblas.cmake index 2155b2955..7615408b2 100644 --- a/cmake/Openblas.cmake +++ b/cmake/Openblas.cmake @@ -51,6 +51,22 @@ int main(int argc, char **argv) COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} LINK_LIBRARIES ${BLAS_REQUIRED_LIBRARIES} OUTPUT_VARIABLE SGEMM_ERR) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/saxpy.c" " +#include <stddef.h> +extern void cblas_saxpy(const int __N, + const float __alpha, const float *__X, const int __incX, float *__Y, const int __incY); +int main(int argc, char **argv) +{ + cblas_saxpy(0, 0, NULL, 0, NULL, 0); + return 0; +} +") + try_compile(HAVE_CBLAS_SAXPY + ${CMAKE_CURRENT_BINARY_DIR} + "${CMAKE_CURRENT_BINARY_DIR}/saxpy.c" + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + LINK_LIBRARIES ${BLAS_REQUIRED_LIBRARIES} + OUTPUT_VARIABLE SAXPY_ERR) # Cmake is just brain damaged #CHECK_LIBRARY_EXISTS(${BLAS_REQUIRED_LIBRARIES} cblas_sgemm "" HAVE_CBLAS_SGEMM) @@ -60,5 +76,11 @@ int main(int argc, char **argv) else() MESSAGE(STATUS "Blas has -NOT- CBLAS sgemm, use internal workaround: ${SGEMM_ERR}") endif() + if(HAVE_CBLAS_SAXPY) + MESSAGE(STATUS "Blas has CBLAS saxpy") + ADD_COMPILE_OPTIONS(-DHAVE_CBLAS_SAXPY) + else() + MESSAGE(STATUS "Blas has -NOT- CBLAS saxpy, use internal workaround: ${SAXPY_ERR}") + endif() ADD_COMPILE_OPTIONS(-DHAVE_CBLAS) ENDIF(WITH_BLAS)
\ No newline at end of file |