| @@ -9,6 +9,10 @@ extern "C" { | |||||
| #include <stddef.h> | #include <stddef.h> | ||||
| #include "common.h" | #include "common.h" | ||||
| /*Set the number of threads on runtime.*/ | |||||
| void openblas_set_num_threads(int num_threads); | |||||
| void goto_set_num_threads(int num_threads); | |||||
| #define CBLAS_INDEX size_t | #define CBLAS_INDEX size_t | ||||
| enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102}; | enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102}; | ||||
| @@ -45,6 +45,8 @@ extern "C" { | |||||
| int BLASFUNC(xerbla)(char *, blasint *info, blasint); | int BLASFUNC(xerbla)(char *, blasint *info, blasint); | ||||
| void BLASFUNC(openblas_set_num_threads)(int *); | |||||
| FLOATRET BLASFUNC(sdot) (blasint *, float *, blasint *, float *, blasint *); | FLOATRET BLASFUNC(sdot) (blasint *, float *, blasint *, float *, blasint *); | ||||
| FLOATRET BLASFUNC(sdsdot)(blasint *, float *, float *, blasint *, float *, blasint *); | FLOATRET BLASFUNC(sdsdot)(blasint *, float *, float *, blasint *, float *, blasint *); | ||||
| @@ -1,12 +1,12 @@ | |||||
| TOPDIR = ../.. | TOPDIR = ../.. | ||||
| include ../../Makefile.system | include ../../Makefile.system | ||||
| COMMONOBJS = memory.$(SUFFIX) xerbla.$(SUFFIX) c_abs.$(SUFFIX) z_abs.$(SUFFIX) | |||||
| COMMONOBJS = memory.$(SUFFIX) xerbla.$(SUFFIX) c_abs.$(SUFFIX) z_abs.$(SUFFIX) openblas_set_num_threads.$(SUFFIX) | |||||
| COMMONOBJS += slamch.$(SUFFIX) slamc3.$(SUFFIX) dlamch.$(SUFFIX) dlamc3.$(SUFFIX) | COMMONOBJS += slamch.$(SUFFIX) slamc3.$(SUFFIX) dlamch.$(SUFFIX) dlamc3.$(SUFFIX) | ||||
| ifdef SMP | ifdef SMP | ||||
| COMMONOBJS += blas_server.$(SUFFIX) divtable.$(SUFFIX) blasL1thread.$(SUFFIX) openblas_set_num_threads.$(SUFFIX) | |||||
| COMMONOBJS += blas_server.$(SUFFIX) divtable.$(SUFFIX) blasL1thread.$(SUFFIX) | |||||
| ifndef NO_AFFINITY | ifndef NO_AFFINITY | ||||
| COMMONOBJS += init.$(SUFFIX) | COMMONOBJS += init.$(SUFFIX) | ||||
| endif | endif | ||||
| @@ -1,5 +1,5 @@ | |||||
| /***************************************************************************** | /***************************************************************************** | ||||
| Copyright (c) 2011, Lab of Parallel Software and Computational Science,ICSAS | |||||
| Copyright (c) 2011,2012 Lab of Parallel Software and Computational Science,ISCAS | |||||
| All rights reserved. | All rights reserved. | ||||
| Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
| @@ -33,7 +33,6 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||
| #include "common.h" | #include "common.h" | ||||
| #ifdef SMP_SERVER | #ifdef SMP_SERVER | ||||
| #ifdef OS_LINUX | |||||
| extern void openblas_set_num_threads(int num_threads) ; | extern void openblas_set_num_threads(int num_threads) ; | ||||
| @@ -41,5 +40,13 @@ void NAME(int* num_threads){ | |||||
| openblas_set_num_threads(*num_threads); | openblas_set_num_threads(*num_threads); | ||||
| } | } | ||||
| #endif | |||||
| #else | |||||
| //Single thread | |||||
| void openblas_set_num_threads(int num_threads) { | |||||
| } | |||||
| void NAME(int* num_threads){ | |||||
| } | |||||
| #endif | #endif | ||||
| @@ -72,6 +72,14 @@ | |||||
| zgemm3m, cgemm3m, zsymm3m, csymm3m, zhemm3m, chemm3m, | zgemm3m, cgemm3m, zsymm3m, csymm3m, zhemm3m, chemm3m, | ||||
| ); | ); | ||||
| @misc_no_underscore_objs = ( | |||||
| openblas_set_num_threads, goto_set_num_threads, | |||||
| ); | |||||
| @misc_underscore_objs = ( | |||||
| openblas_set_num_threads, | |||||
| ); | |||||
| @lapackobjs = ( | @lapackobjs = ( | ||||
| # These routines are provided by OpenBLAS. | # These routines are provided by OpenBLAS. | ||||
| sgesv, dgesv, cgesv, zgesv, | sgesv, dgesv, cgesv, zgesv, | ||||
| @@ -2660,11 +2668,11 @@ | |||||
| if ($ARGV[5] == 1) { | if ($ARGV[5] == 1) { | ||||
| #NO_LAPACK=1 | #NO_LAPACK=1 | ||||
| @underscore_objs = (@blasobjs); | |||||
| @underscore_objs = (@blasobjs, @misc_underscore_objs); | |||||
| } elsif (-d "../lapack-3.1.1" || -d "../lapack-3.4.0" || -d "../lapack-3.4.1") { | } elsif (-d "../lapack-3.1.1" || -d "../lapack-3.4.0" || -d "../lapack-3.4.1") { | ||||
| @underscore_objs = (@blasobjs, @lapackobjs, @lapackobjs2); | |||||
| @underscore_objs = (@blasobjs, @lapackobjs, @lapackobjs2, @misc_underscore_objs); | |||||
| } else { | } else { | ||||
| @underscore_objs = (@blasobjs, @lapackobjs); | |||||
| @underscore_objs = (@blasobjs, @lapackobjs, @misc_underscore_objs); | |||||
| } | } | ||||
| if ($ARGV[3] == 1){ @underscore_objs = (@underscore_objs, @exblasobjs); }; | if ($ARGV[3] == 1){ @underscore_objs = (@underscore_objs, @exblasobjs); }; | ||||
| @@ -2678,10 +2686,10 @@ if ($ARGV[1] eq "ia64"){ @underscore_objs = (@underscore_objs, @gemm3mobjs); }; | |||||
| if ($ARGV[1] eq "MIPS"){ @underscore_objs = (@underscore_objs, @gemm3mobjs); }; | if ($ARGV[1] eq "MIPS"){ @underscore_objs = (@underscore_objs, @gemm3mobjs); }; | ||||
| if ($ARGV[4] == 0) { | if ($ARGV[4] == 0) { | ||||
| @no_underscore_objs = (@cblasobjs); | |||||
| @no_underscore_objs = (@cblasobjs, @misc_no_underscore_objs); | |||||
| }else{ | }else{ | ||||
| #NO_CBLAS=1 | #NO_CBLAS=1 | ||||
| @no_underscore_objs = (); | |||||
| @no_underscore_objs = (@misc_no_underscore_objs); | |||||
| } | } | ||||
| if ($ARGV[6] == 1) { | if ($ARGV[6] == 1) { | ||||
| #NO_LAPACKE=1 | #NO_LAPACKE=1 | ||||