From 6df39ad9e75d0c8250bc4146c09fb38f8954b612 Mon Sep 17 00:00:00 2001 From: Zhang Xianyi Date: Wed, 10 Jul 2013 16:02:27 +0800 Subject: [PATCH] Refs #248. Support LAPACK and LAPACKE with lsbcc. For LAPACKE, use LAPACK_COMPLEX_STRUCTURE. The reson is lsbcc didn't define complex I in complex.h. --- Makefile | 6 +----- Makefile.system | 26 +++++++++++++++++++++----- c_check | 3 ++- ctest.c | 10 ++++++++++ exports/Makefile | 5 +++++ 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 2d6e51dc7..873b6dedd 100644 --- a/Makefile +++ b/Makefile @@ -227,11 +227,7 @@ ifndef NOFORTRAN -@echo "PNOOPT = $(FPFLAGS) -O0" >> $(NETLIB_LAPACK_DIR)/make.inc -@echo "LOADOPTS = $(FFLAGS) $(EXTRALIB)" >> $(NETLIB_LAPACK_DIR)/make.inc -@echo "CC = $(CC)" >> $(NETLIB_LAPACK_DIR)/make.inc -ifdef INTERFACE64 - -@echo "override CFLAGS = $(CFLAGS) -DHAVE_LAPACK_CONFIG_H -DLAPACK_ILP64" >> $(NETLIB_LAPACK_DIR)/make.inc -else - -@echo "override CFLAGS = $(CFLAGS)" >> $(NETLIB_LAPACK_DIR)/make.inc -endif + -@echo "override CFLAGS = $(LAPACK_CFLAGS)" >> $(NETLIB_LAPACK_DIR)/make.inc -@echo "ARCH = $(AR)" >> $(NETLIB_LAPACK_DIR)/make.inc -@echo "ARCHFLAGS = -ru" >> $(NETLIB_LAPACK_DIR)/make.inc -@echo "RANLIB = $(RANLIB)" >> $(NETLIB_LAPACK_DIR)/make.inc diff --git a/Makefile.system b/Makefile.system index 5c5801361..1388a816e 100644 --- a/Makefile.system +++ b/Makefile.system @@ -240,7 +240,8 @@ NO_BINARY_MODE = 1 endif ifndef NO_EXPRECISION ifeq ($(F_COMPILER), GFORTRAN) -ifeq ($(C_COMPILER), GCC) +# ifeq logical or. GCC or LSB +ifeq ($(C_COMPILER), $(filter $(C_COMPILER),GCC LSB)) EXPRECISION = 1 CCOMMON_OPT += -DEXPRECISION -m128bit-long-double FCOMMON_OPT += -m128bit-long-double @@ -257,7 +258,8 @@ endif ifeq ($(ARCH), x86_64) ifndef NO_EXPRECISION ifeq ($(F_COMPILER), GFORTRAN) -ifeq ($(C_COMPILER), GCC) +# ifeq logical or. GCC or LSB +ifeq ($(C_COMPILER), $(filter $(C_COMPILER),GCC LSB)) EXPRECISION = 1 CCOMMON_OPT += -DEXPRECISION -m128bit-long-double FCOMMON_OPT += -m128bit-long-double @@ -276,7 +278,8 @@ CCOMMON_OPT += -wd981 endif ifeq ($(USE_OPENMP), 1) -ifeq ($(C_COMPILER), GCC) +# ifeq logical or. GCC or LSB +ifeq ($(C_COMPILER), $(filter $(C_COMPILER),GCC LSB)) CCOMMON_OPT += -fopenmp endif @@ -350,9 +353,10 @@ endif # C Compiler dependent settings # -# ifeq logical or. GCC or CLANG + +# ifeq logical or. GCC or CLANG or LSB # http://stackoverflow.com/questions/7656425/makefile-ifeq-logical-or -ifeq ($(C_COMPILER), $(filter $(C_COMPILER),GCC CLANG)) +ifeq ($(C_COMPILER), $(filter $(C_COMPILER),GCC CLANG LSB)) CCOMMON_OPT += -Wall COMMON_PROF += -fno-inline NO_UNINITIALIZED_WARN = -Wno-uninitialized @@ -445,9 +449,12 @@ endif ifeq ($(F_COMPILER), GFORTRAN) CCOMMON_OPT += -DF_INTERFACE_GFORT FCOMMON_OPT += -Wall +#Don't include -lgfortran, when NO_LAPACK=1 or lsbcc ifneq ($(NO_LAPACK), 1) +ifneq ($(C_COMPILER), LSB) EXTRALIB += -lgfortran endif +endif ifdef NO_BINARY_MODE ifeq ($(ARCH), mips64) ifdef BINARY64 @@ -781,6 +788,15 @@ override FFLAGS += $(COMMON_OPT) $(FCOMMON_OPT) override FPFLAGS += $(COMMON_OPT) $(FCOMMON_OPT) $(COMMON_PROF) #MAKEOVERRIDES = +LAPACK_CFLAGS = $(CFLAGS) +LAPACK_CFLAGS += -DHAVE_LAPACK_CONFIG_H +ifdef INTERFACE64 +LAPACK_CFLAGS += -DLAPACK_ILP64 +endif +ifeq ($(C_COMPILER), LSB) +LAPACK_CFLAGS += -DLAPACK_COMPLEX_STRUCTURE +endif + ifndef SUFFIX SUFFIX = o endif diff --git a/c_check b/c_check index acd8df5f4..d5fe59f75 100644 --- a/c_check +++ b/c_check @@ -33,6 +33,7 @@ if ($ARGV[0] =~ /(.*)(-[.\d]+)/) { } $compiler = ""; +$compiler = LSB if ($data =~ /COMPILER_LSB/); $compiler = CLANG if ($data =~ /COMPILER_CLANG/); $compiler = PGI if ($data =~ /COMPILER_PGI/); $compiler = PATHSCALE if ($data =~ /COMPILER_PATHSCALE/); @@ -122,7 +123,7 @@ if ($compiler eq "CLANG") { $openmp = "-fopenmp"; } -if ($compiler eq "GCC") { +if ($compiler eq "GCC" || $compiler eq "LSB") { $openmp = "-fopenmp"; } diff --git a/ctest.c b/ctest.c index 624cad159..413519274 100644 --- a/ctest.c +++ b/ctest.c @@ -1,3 +1,13 @@ +//LSB (Linux Standard Base) compiler +//only support lsbc++ +#if defined (__LSB_VERSION__) +#if !defined (__cplusplus) +COMPILER_LSB +#else +#error "OpenBLAS only supports lsbcc." +#endif +#endif + #if defined(__clang__) COMPILER_CLANG #endif diff --git a/exports/Makefile b/exports/Makefile index 15041be86..6502d5d01 100644 --- a/exports/Makefile +++ b/exports/Makefile @@ -119,7 +119,12 @@ so : ../$(LIBSONAME) $(CC) $(CFLAGS) -shared -o ../$(LIBSONAME) \ -Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive \ -Wl,--retain-symbols-file=linux.def -Wl,-soname,$(LIBPREFIX).so.$(MAJOR_VERSION) $(EXTRALIB) +ifneq ($(C_COMPILER), LSB) $(CC) $(CFLAGS) -w -o linktest linktest.c ../$(LIBSONAME) $(FEXTRALIB) && echo OK. +else +#Use FC on LSB + $(FC) $(FFLAGS) -w -o linktest linktest.c ../$(LIBSONAME) $(FEXTRALIB) && echo OK. +endif rm -f linktest endif