Refs #248. Fixed the LSB compatiable issue for BLAS only.
authorZhang Xianyi <traits.zhang@gmail.com>
Tue, 9 Jul 2013 07:38:03 +0000 (15:38 +0800)
committerZhang Xianyi <traits.zhang@gmail.com>
Tue, 9 Jul 2013 07:38:03 +0000 (15:38 +0800)
For example, make CC=lsbcc NO_LAPACK=1.

Makefile.system
common_linux.h
driver/others/init.c
driver/others/memory.c
getarch.c

index 196d005..d439d50 100644 (file)
@@ -447,7 +447,9 @@ endif
 ifeq ($(F_COMPILER), GFORTRAN)
 CCOMMON_OPT += -DF_INTERFACE_GFORT
 FCOMMON_OPT += -Wall
+ifneq ($(NO_LAPACK), 1)
 EXTRALIB += -lgfortran 
+endif
 ifdef NO_BINARY_MODE
 ifeq ($(ARCH), mips64)
 ifdef BINARY64
index 6766ff3..afc77b4 100644 (file)
@@ -65,9 +65,16 @@ extern long int syscall (long int __sysno, ...);
 #endif
 #endif
 
+
+
 static inline int my_mbind(void *addr, unsigned long len, int mode,
                           unsigned long *nodemask, unsigned long maxnode,
                           unsigned flags) {
+#if defined (__LSB_VERSION__)
+// So far,  LSB (Linux Standard Base) don't support syscall().
+// https://lsbbugs.linuxfoundation.org/show_bug.cgi?id=3482
+        return 0;
+#else
 #if defined (LOONGSON3B) 
 #if defined (__64BIT__)
        return syscall(SYS_mbind, addr, len, mode, nodemask, maxnode, flags);
@@ -79,11 +86,17 @@ static inline int my_mbind(void *addr, unsigned long len, int mode,
 //     unsigned long null_nodemask=0;
        return syscall(SYS_mbind, addr, len, mode, nodemask, maxnode, flags);
 #endif
+#endif
 }
 
 static inline int my_set_mempolicy(int mode, const unsigned long *addr, unsigned long flag) {
-
+#if defined (__LSB_VERSION__)
+// So far,  LSB (Linux Standard Base) don't support syscall().
+// https://lsbbugs.linuxfoundation.org/show_bug.cgi?id=3482
+  return 0;
+#else
   return syscall(SYS_set_mempolicy, mode, addr, flag);
+#endif
 }
 
 static inline int my_gettid(void) { 
index f6924d5..4efc281 100644 (file)
@@ -82,6 +82,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <sched.h>
 #include <dirent.h>
 #include <dlfcn.h>
+#include <unistd.h>
 
 #define MAX_NODES      16
 #define MAX_CPUS       256
@@ -735,7 +736,8 @@ void gotoblas_affinity_init(void) {
     fprintf(stderr, "Shared Memory Initialization.\n");
 #endif
 
-    common -> num_procs = get_nprocs();
+    //returns the number of processors which are currently online
+    common -> num_procs = sysconf(_SC_NPROCESSORS_ONLN);;
 
     if(common -> num_procs > MAX_CPUS) {
       fprintf(stderr, "\nOpenBLAS Warining : The number of CPU/Cores(%d) is beyond the limit(%d). Terminated.\n", common->num_procs, MAX_CPUS);
index d8046d7..4f35691 100644 (file)
@@ -126,7 +126,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define NO_WARMUP
 #endif
 
-#ifdef ALLOC_HUGETLB
+#ifndef SHM_HUGETLB
 #define SHM_HUGETLB 04000
 #endif
 
index 7f62e54..b4573d3 100644 (file)
--- a/getarch.c
+++ b/getarch.c
@@ -83,6 +83,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #endif
 #ifdef linux
 #include <sys/sysinfo.h>
+#include <unistd.h>
 #endif
 
 /* #define FORCE_P2            */
@@ -736,7 +737,8 @@ static int get_num_cores(void) {
 #endif
   
 #ifdef linux
-  return get_nprocs();
+  //returns the number of processors which are currently online
+  return sysconf(_SC_NPROCESSORS_ONLN);
   
 #elif defined(OS_WINDOWS)