diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-01 14:23:05 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-01 14:23:05 +0000 |
commit | b2edec9720abff1519460b141b64a11f8fdf70cc (patch) | |
tree | 8d8243623775dbde2045b31595017c120322550a | |
parent | a69d59e4692ae5fdf326e5d0190fe6bed5d823e1 (diff) | |
download | rspamd-b2edec9720abff1519460b141b64a11f8fdf70cc.tar.gz rspamd-b2edec9720abff1519460b141b64a11f8fdf70cc.zip |
[Minor] Support threads for MKL blas
-rw-r--r-- | contrib/torch/torch7/lib/TH/THGeneral.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/torch/torch7/lib/TH/THGeneral.c b/contrib/torch/torch7/lib/TH/THGeneral.c index 50dba205f..b9491c9f3 100644 --- a/contrib/torch/torch7/lib/TH/THGeneral.c +++ b/contrib/torch/torch7/lib/TH/THGeneral.c @@ -328,6 +328,11 @@ void THSetNumThreads(int num_threads) extern void openblas_set_num_threads(int); openblas_set_num_threads(num_threads); #endif +#ifdef TH_BLAS_MKL + extern void mkl_set_num_threads(int); + mkl_set_num_threads(num_threads); + +#endif } int THGetNumThreads(void) @@ -342,7 +347,12 @@ int THGetNumThreads(void) bl_threads = openblas_get_num_threads(); nthreads = nthreads > bl_threads ? bl_threads : nthreads; #endif - +#ifdef TH_BLAS_MKL + int bl_threads = 1; + extern int mkl_get_max_threads(void); + bl_threads = mkl_get_max_threads(); + nthreads = nthreads > bl_threads ? bl_threads : nthreads; +#endif return nthreads; } |