diff options
author | Zhang Xianyi <traits.zhang@gmail.com> | 2013-07-09 15:38:03 +0800 |
---|---|---|
committer | Zhang Xianyi <traits.zhang@gmail.com> | 2013-07-09 15:38:03 +0800 |
commit | f54f5bac9e9b0127052a23aaa7c9cfc4170b1f00 (patch) | |
tree | f8b7ed41b450ef937ba1cb9a11e6aab8bc3be183 | |
parent | 5d3312142a2926bad34924971208673818947120 (diff) | |
download | openblas-f54f5bac9e9b0127052a23aaa7c9cfc4170b1f00.tar.gz openblas-f54f5bac9e9b0127052a23aaa7c9cfc4170b1f00.tar.bz2 openblas-f54f5bac9e9b0127052a23aaa7c9cfc4170b1f00.zip |
Refs #248. Fixed the LSB compatiable issue for BLAS only.
For example, make CC=lsbcc NO_LAPACK=1.
-rw-r--r-- | Makefile.system | 2 | ||||
-rw-r--r-- | common_linux.h | 15 | ||||
-rw-r--r-- | driver/others/init.c | 4 | ||||
-rw-r--r-- | driver/others/memory.c | 2 | ||||
-rw-r--r-- | getarch.c | 4 |
5 files changed, 23 insertions, 4 deletions
diff --git a/Makefile.system b/Makefile.system index 196d005fb..d439d5001 100644 --- a/Makefile.system +++ b/Makefile.system @@ -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 diff --git a/common_linux.h b/common_linux.h index 6766ff37c..afc77b4a2 100644 --- a/common_linux.h +++ b/common_linux.h @@ -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) { diff --git a/driver/others/init.c b/driver/others/init.c index f6924d5f4..4efc2816a 100644 --- a/driver/others/init.c +++ b/driver/others/init.c @@ -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); diff --git a/driver/others/memory.c b/driver/others/memory.c index d8046d7bd..4f35691ff 100644 --- a/driver/others/memory.c +++ b/driver/others/memory.c @@ -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 @@ -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) |