Export openblas_set_num_threads in shared library.
authorZhang Xianyi <xianyi@iscas.ac.cn>
Sat, 23 Jun 2012 03:32:43 +0000 (11:32 +0800)
committerZhang Xianyi <xianyi@iscas.ac.cn>
Sat, 23 Jun 2012 03:32:43 +0000 (11:32 +0800)
cblas.h
common_interface.h
driver/others/Makefile
driver/others/openblas_set_num_threads.c
exports/gensymbol

diff --git a/cblas.h b/cblas.h
index f3708a9..ee8bf08 100644 (file)
--- a/cblas.h
+++ b/cblas.h
@@ -9,6 +9,10 @@ extern "C" {
 #include <stddef.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
 
 enum CBLAS_ORDER     {CblasRowMajor=101, CblasColMajor=102};
index 898d910..dbe0bb8 100644 (file)
@@ -45,6 +45,8 @@ extern "C" {
 
 int    BLASFUNC(xerbla)(char *, blasint *info, blasint);
 
+void    BLASFUNC(openblas_set_num_threads)(int *);
+
 FLOATRET  BLASFUNC(sdot)  (blasint *, float  *, blasint *, float  *, blasint *);
 FLOATRET  BLASFUNC(sdsdot)(blasint *, float  *,        float  *, blasint *, float  *, blasint *);
 
index 75b552b..2fdbb4a 100644 (file)
@@ -1,12 +1,12 @@
 TOPDIR = ../..
 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)
 
 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
 COMMONOBJS     += init.$(SUFFIX) 
 endif
index 7ca3b71..27de83f 100644 (file)
@@ -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.
 
 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"
 
 #ifdef SMP_SERVER
-#ifdef OS_LINUX
 
 extern  void openblas_set_num_threads(int num_threads) ;
 
@@ -41,5 +40,13 @@ void NAME(int* 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
index dbd5594..61e7c83 100644 (file)
               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 = (
               # These routines are provided by OpenBLAS.
               sgesv,  dgesv,  cgesv,  zgesv, 
 
 if ($ARGV[5] == 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") {
-    @underscore_objs = (@blasobjs, @lapackobjs, @lapackobjs2);
+    @underscore_objs = (@blasobjs, @lapackobjs, @lapackobjs2, @misc_underscore_objs);
 } else {
-    @underscore_objs = (@blasobjs, @lapackobjs);
+    @underscore_objs = (@blasobjs, @lapackobjs, @misc_underscore_objs);
 }
 
 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[4] == 0) {
-    @no_underscore_objs = (@cblasobjs);
+    @no_underscore_objs = (@cblasobjs, @misc_no_underscore_objs);
 }else{
     #NO_CBLAS=1
-    @no_underscore_objs = ();
+    @no_underscore_objs = (@misc_no_underscore_objs);
 }
 if ($ARGV[6] == 1) {
     #NO_LAPACKE=1