diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-09-02 13:05:58 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-09-02 13:05:58 +0100 |
commit | 54daeb811d83f5d4e29e208e7285c669d123f606 (patch) | |
tree | aa582cc7c1d5a8ea3f72f2db40c18f4a5da6fbf2 /src | |
parent | 75d2e6e32450b355f32a06745abc2f9446febce7 (diff) | |
download | rspamd-54daeb811d83f5d4e29e208e7285c669d123f606.tar.gz rspamd-54daeb811d83f5d4e29e208e7285c669d123f606.zip |
[Rework] Change and improve openblas detection and usage
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/cfg_utils.c | 10 | ||||
-rw-r--r-- | src/libutil/util.c | 12 | ||||
-rw-r--r-- | src/lua/lua_tensor.c | 1 |
3 files changed, 7 insertions, 16 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index 6b3f3e15b..0b87bc985 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -55,6 +55,8 @@ #endif #include <math.h> +#include "blas-config.h" + #define DEFAULT_SCORE 10.0 #define DEFAULT_RLIMIT_NOFILE 2048 @@ -2782,13 +2784,9 @@ rspamd_free_zstd_dictionary (struct zstd_dictionary *dict) } } -#ifdef HAVE_CBLAS -#ifdef HAVE_CBLAS_H -#include "cblas.h" -#else +#ifdef HAVE_OPENBLAS_SET_NUM_THREADS extern void openblas_set_num_threads(int num_threads); #endif -#endif gboolean rspamd_config_libs (struct rspamd_external_libs_ctx *ctx, @@ -2892,7 +2890,7 @@ rspamd_config_libs (struct rspamd_external_libs_ctx *ctx, ZSTD_freeCStream (ctx->out_zstream); ctx->out_zstream = NULL; } -#ifdef HAVE_CBLAS +#ifdef HAVE_OPENBLAS_SET_NUM_THREADS openblas_set_num_threads (cfg->max_blas_threads); #endif } diff --git a/src/libutil/util.c b/src/libutil/util.c index 9e5147ab5..1aed0f8b4 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -64,6 +64,7 @@ #include "zlib.h" #include "contrib/uthash/utlist.h" +#include "blas-config.h" /* Check log messages intensity once per minute */ #define CHECK_TIME 60 @@ -1705,17 +1706,8 @@ void rspamd_gerror_free_maybe (gpointer p) -#ifdef HAVE_CBLAS -#ifdef HAVE_CBLAS_H -#include "cblas.h" -#else -#ifdef __APPLE__ -/* OSX is pure evil: number of threads must be set via env: VECLIB_MAXIMUM_THREADS */ -void openblas_set_num_threads(int num_threads) {} -#else +#ifdef HAVE_OPENBLAS_SET_NUM_THREADS extern void openblas_set_num_threads(int num_threads); -#endif -#endif /* * Openblas creates threads that are not supported by * jemalloc allocator (aside of being bloody stupid). So this hack diff --git a/src/lua/lua_tensor.c b/src/lua/lua_tensor.c index 06b7cdffe..960fc31e0 100644 --- a/src/lua/lua_tensor.c +++ b/src/lua/lua_tensor.c @@ -17,6 +17,7 @@ #include "lua_common.h" #include "lua_tensor.h" #include "contrib/kann/kautodiff.h" +#include "blas-config.h" /*** * @module rspamd_tensor |