Sitelet https://github.com/piclas-framework/OpenBLAS/commit/f54f5bac9e9b0127052a23aaa7c9cfc4170b1f00
Skip to content

Commit f54f5ba

Browse files
committed
Refs OpenMathLib#248. Fixed the LSB compatiable issue for BLAS only.
For example, make CC=lsbcc NO_LAPACK=1.
1 parent 5d33121 commit f54f5ba

5 files changed

Lines changed: 23 additions & 4 deletions

File tree

‎Makefile.system‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,9 @@ endif
447447
ifeq ($(F_COMPILER), GFORTRAN)
448448
CCOMMON_OPT += -DF_INTERFACE_GFORT
449449
FCOMMON_OPT += -Wall
450+
ifneq ($(NO_LAPACK), 1)
450451
EXTRALIB += -lgfortran
452+
endif
451453
ifdef NO_BINARY_MODE
452454
ifeq ($(ARCH), mips64)
453455
ifdef BINARY64

‎common_linux.h‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,16 @@ extern long int syscall (long int __sysno, ...);
6565
#endif
6666
#endif
6767

68+
69+
6870
static inline int my_mbind(void *addr, unsigned long len, int mode,
6971
unsigned long *nodemask, unsigned long maxnode,
7072
unsigned flags) {
73+
#if defined (__LSB_VERSION__)
74+
// So far, LSB (Linux Standard Base) don't support syscall().
75+
// https://lsbbugs.linuxfoundation.org/show_bug.cgi?id=3482
76+
return 0;
77+
#else
7178
#if defined (LOONGSON3B)
7279
#if defined (__64BIT__)
7380
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,
7986
// unsigned long null_nodemask=0;
8087
return syscall(SYS_mbind, addr, len, mode, nodemask, maxnode, flags);
8188
#endif
89+
#endif
8290
}
8391

8492
static inline int my_set_mempolicy(int mode, const unsigned long *addr, unsigned long flag) {
85-
93+
#if defined (__LSB_VERSION__)
94+
// So far, LSB (Linux Standard Base) don't support syscall().
95+
// https://lsbbugs.linuxfoundation.org/show_bug.cgi?id=3482
96+
return 0;
97+
#else
8698
return syscall(SYS_set_mempolicy, mode, addr, flag);
99+
#endif
87100
}
88101

89102
static inline int my_gettid(void) {

‎driver/others/init.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8282
#include <sched.h>
8383
#include <dirent.h>
8484
#include <dlfcn.h>
85+
#include <unistd.h>
8586

8687
#define MAX_NODES 16
8788
#define MAX_CPUS 256
@@ -735,7 +736,8 @@ void gotoblas_affinity_init(void) {
735736
fprintf(stderr, "Shared Memory Initialization.\n");
736737
#endif
737738

738-
common -> num_procs = get_nprocs();
739+
//returns the number of processors which are currently online
740+
common -> num_procs = sysconf(_SC_NPROCESSORS_ONLN);;
739741

740742
if(common -> num_procs > MAX_CPUS) {
741743
fprintf(stderr, "\nOpenBLAS Warining : The number of CPU/Cores(%d) is beyond the limit(%d). Terminated.\n", common->num_procs, MAX_CPUS);

‎driver/others/memory.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
126126
#define NO_WARMUP
127127
#endif
128128

129-
#ifdef ALLOC_HUGETLB
129+
#ifndef SHM_HUGETLB
130130
#define SHM_HUGETLB 04000
131131
#endif
132132

‎getarch.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8383
#endif
8484
#ifdef linux
8585
#include <sys/sysinfo.h>
86+
#include <unistd.h>
8687
#endif
8788

8889
/* #define FORCE_P2 */
@@ -736,7 +737,8 @@ static int get_num_cores(void) {
736737
#endif
737738

738739
#ifdef linux
739-
return get_nprocs();
740+
//returns the number of processors which are currently online
741+
return sysconf(_SC_NPROCESSORS_ONLN);
740742

741743
#elif defined(OS_WINDOWS)
742744

0 commit comments

Comments
 (0)