Permalink
Browse files

Export openblas_set_num_threads in shared library.

  • Loading branch information...
1 parent 544af1e commit 422359d09ac28b27bb652b303318485fb2c02cca @xianyi committed Jun 23, 2012
Showing with 31 additions and 10 deletions.
  1. +4 −0 cblas.h
  2. +2 −0 common_interface.h
  3. +2 −2 driver/others/Makefile
  4. +10 −3 driver/others/openblas_set_num_threads.c
  5. +13 −5 exports/gensymbol
View
@@ -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};
View
@@ -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 *);
View
@@ -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
@@ -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,13 +33,20 @@ 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) ;
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
View
@@ -72,6 +72,14 @@
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,
@@ -2660,11 +2668,11 @@
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

0 comments on commit 422359d

Please sign in to comment.