Refs #248. Fixed the LSB compatiable issue for BLAS only.

For example, make CC=lsbcc NO_LAPACK=1.
This commit is contained in:
Zhang Xianyi 2013-07-09 15:38:03 +08:00
parent 5d3312142a
commit f54f5bac9e
5 changed files with 23 additions and 4 deletions

View File

@ -447,7 +447,9 @@ endif
ifeq ($(F_COMPILER), GFORTRAN) ifeq ($(F_COMPILER), GFORTRAN)
CCOMMON_OPT += -DF_INTERFACE_GFORT CCOMMON_OPT += -DF_INTERFACE_GFORT
FCOMMON_OPT += -Wall FCOMMON_OPT += -Wall
ifneq ($(NO_LAPACK), 1)
EXTRALIB += -lgfortran EXTRALIB += -lgfortran
endif
ifdef NO_BINARY_MODE ifdef NO_BINARY_MODE
ifeq ($(ARCH), mips64) ifeq ($(ARCH), mips64)
ifdef BINARY64 ifdef BINARY64

View File

@ -65,9 +65,16 @@ extern long int syscall (long int __sysno, ...);
#endif #endif
#endif #endif
static inline int my_mbind(void *addr, unsigned long len, int mode, static inline int my_mbind(void *addr, unsigned long len, int mode,
unsigned long *nodemask, unsigned long maxnode, unsigned long *nodemask, unsigned long maxnode,
unsigned flags) { 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 (LOONGSON3B)
#if defined (__64BIT__) #if defined (__64BIT__)
return syscall(SYS_mbind, addr, len, mode, nodemask, maxnode, flags); 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; // unsigned long null_nodemask=0;
return syscall(SYS_mbind, addr, len, mode, nodemask, maxnode, flags); return syscall(SYS_mbind, addr, len, mode, nodemask, maxnode, flags);
#endif #endif
#endif
} }
static inline int my_set_mempolicy(int mode, const unsigned long *addr, unsigned long flag) { 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); return syscall(SYS_set_mempolicy, mode, addr, flag);
#endif
} }
static inline int my_gettid(void) { static inline int my_gettid(void) {

View File

@ -82,6 +82,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <sched.h> #include <sched.h>
#include <dirent.h> #include <dirent.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <unistd.h>
#define MAX_NODES 16 #define MAX_NODES 16
#define MAX_CPUS 256 #define MAX_CPUS 256
@ -735,7 +736,8 @@ void gotoblas_affinity_init(void) {
fprintf(stderr, "Shared Memory Initialization.\n"); fprintf(stderr, "Shared Memory Initialization.\n");
#endif #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) { 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); fprintf(stderr, "\nOpenBLAS Warining : The number of CPU/Cores(%d) is beyond the limit(%d). Terminated.\n", common->num_procs, MAX_CPUS);

View File

@ -126,7 +126,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define NO_WARMUP #define NO_WARMUP
#endif #endif
#ifdef ALLOC_HUGETLB #ifndef SHM_HUGETLB
#define SHM_HUGETLB 04000 #define SHM_HUGETLB 04000
#endif #endif

View File

@ -83,6 +83,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif #endif
#ifdef linux #ifdef linux
#include <sys/sysinfo.h> #include <sys/sysinfo.h>
#include <unistd.h>
#endif #endif
/* #define FORCE_P2 */ /* #define FORCE_P2 */
@ -736,7 +737,8 @@ static int get_num_cores(void) {
#endif #endif
#ifdef linux #ifdef linux
return get_nprocs(); //returns the number of processors which are currently online
return sysconf(_SC_NPROCESSORS_ONLN);
#elif defined(OS_WINDOWS) #elif defined(OS_WINDOWS)