From: Zhang Xianyi Date: Tue, 20 Aug 2013 16:03:25 +0000 (+0800) Subject: Refs #279. Provide ONLY_CBLAS flag. If you only need CBLAS without X-Git-Tag: v0.2.9.rc1~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c92ae012a6edf63461ab81dd0bd997541fd7d3ad;p=platform%2Fupstream%2Fopenblas.git Refs #279. Provide ONLY_CBLAS flag. If you only need CBLAS without a fortran compiler, please try make ONLY_CBLAS=1. This mode only compiler CBLAS without BLAS fortran interface and LAPACK. --- diff --git a/Makefile b/Makefile index 86fbf2c..9583085 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ SUBDIRS_ALL = $(SUBDIRS) test ctest utest exports benchmark ../laswp ../bench all :: libs netlib tests shared @echo - @echo " OpenBLAS build complete." + @echo " OpenBLAS build complete. ($(LIB_COMPONENTS))" @echo @echo " OS ... $(OSNAME) " @echo " Architecture ... $(ARCH) " @@ -44,7 +44,9 @@ ifdef INTERFACE64 @echo " Use 64 bits int (equivalent to \"-i8\" in Fortran) " endif @echo " C compiler ... $(C_COMPILER) (command line : $(CC))" +ifndef NOFORTRAN @echo " Fortran compiler ... $(F_COMPILER) (command line : $(FC))" +endif ifneq ($(OSNAME), AIX) @echo -n " Library Name ... $(LIBNAME)" else diff --git a/Makefile.prebuild b/Makefile.prebuild index c7d0de7..3562823 100644 --- a/Makefile.prebuild +++ b/Makefile.prebuild @@ -23,7 +23,17 @@ all: getarch_2nd cblas_noconst.h config.h : c_check f_check getarch perl ./c_check $(TARGET_MAKE) $(TARGET_CONF) $(CC) +ifneq ($(ONLY_CBLAS), 1) perl ./f_check $(TARGET_MAKE) $(TARGET_CONF) $(FC) +else +#When we only build CBLAS, we set NOFORTRAN=2 + echo "NOFORTRAN=2" >> $(TARGET_MAKE) + echo "NO_FBLAS=1" >> $(TARGET_MAKE) + echo "F_COMPILER=GFORTRAN" >> $(TARGET_MAKE) + echo "BU=_" >> $(TARGET_MAKE) + echo "#define BUNDERSCORE _" >> $(TARGET_CONF) + echo "#define NEEDBUNDERSCORE 1" >> $(TARGET_CONF) +endif ./getarch 0 >> $(TARGET_MAKE) ./getarch 1 >> $(TARGET_CONF) diff --git a/Makefile.rule b/Makefile.rule index a92eb50..e357d5c 100644 --- a/Makefile.rule +++ b/Makefile.rule @@ -54,6 +54,10 @@ VERSION = 0.2.8 # If you don't need CBLAS interface, please comment it in. # NO_CBLAS = 1 +# If you only want CBLAS interface without installing Fortran compiler, +# please comment it in. +# ONLY_CBLAS = 1 + # If you don't need LAPACK, please comment it in. # If you set NO_LAPACK=1, the library automatically sets NO_LAPACKE=1. # NO_LAPACK = 1 diff --git a/Makefile.system b/Makefile.system index 9663322..858160f 100644 --- a/Makefile.system +++ b/Makefile.system @@ -82,12 +82,19 @@ ifeq ($(HOSTCC), loongcc) GETARCH_FLAGS += -static endif +#if don't use Fortran, it will only compile CBLAS. +ifeq ($(ONLY_CBLAS), 1) +NO_LAPACK = 1 +else +ONLY_CBLAS = 0 +endif + # This operation is expensive, so execution should be once. ifndef GOTOBLAS_MAKEFILE export GOTOBLAS_MAKEFILE = 1 # Generating Makefile.conf and config.h -DUMMY := $(shell $(MAKE) -C $(TOPDIR) -f Makefile.prebuild CC="$(CC)" FC="$(FC)" HOSTCC="$(HOSTCC)" CFLAGS="$(GETARCH_FLAGS)" BINARY=$(BINARY) USE_OPENMP=$(USE_OPENMP) TARGET_CORE=$(TARGET_CORE) all) +DUMMY := $(shell $(MAKE) -C $(TOPDIR) -f Makefile.prebuild CC="$(CC)" FC="$(FC)" HOSTCC="$(HOSTCC)" CFLAGS="$(GETARCH_FLAGS)" BINARY=$(BINARY) USE_OPENMP=$(USE_OPENMP) TARGET_CORE=$(TARGET_CORE) ONLY_CBLAS=$(ONLY_CBLAS) all) ifndef TARGET_CORE include $(TOPDIR)/Makefile.conf @@ -885,6 +892,23 @@ LIBZIPNAME = $(LIBNAME:.$(LIBSUFFIX)=.zip) LIBS = $(TOPDIR)/$(LIBNAME) LIBS_P = $(TOPDIR)/$(LIBNAME_P) + +LIB_COMPONENTS = BLAS +ifneq ($(NO_CBLAS), 1) +LIB_COMPONENTS += CBLAS +endif + +ifneq ($(NO_LAPACK), 1) +LIB_COMPONENTS += LAPACK +ifneq ($(NO_LAPACKE), 1) +LIB_COMPONENTS += LAPACKE +endif +endif + +ifeq ($(ONLY_CBLAS), 1) +LIB_COMPONENTS = CBLAS +endif + export OSNAME export ARCH export CORE @@ -911,6 +935,7 @@ export USE_OPENMP export CROSS export CROSS_SUFFIX export NOFORTRAN +export NO_FBLAS export EXTRALIB export CEXTRALIB export FEXTRALIB diff --git a/exports/Makefile b/exports/Makefile index 64d7e18..1531f3c 100644 --- a/exports/Makefile +++ b/exports/Makefile @@ -22,6 +22,10 @@ ifndef NEED2UNDERSCORES NEED2UNDERSCORES=0 endif +ifndef ONLY_CBLAS +ONLY_CBLAS = 0 +endif + ifeq ($(OSNAME), WINNT) ifeq ($(F_COMPILER), GFORTRAN) EXTRALIB += -lgfortran @@ -98,13 +102,13 @@ libgoto2_shared.dll : ../$(LIBNAME) libgoto2_shared.def -Wl,--out-implib,libgoto2_shared.lib $(FEXTRALIB) libopenblas.def : gensymbol - perl ./gensymbol win2k $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) > $(@F) + perl ./gensymbol win2k $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) > $(@F) libgoto2_shared.def : gensymbol - perl ./gensymbol win2k $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) > $(@F) + perl ./gensymbol win2k $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) > $(@F) libgoto_hpl.def : gensymbol - perl ./gensymbol win2khpl $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) > $(@F) + perl ./gensymbol win2khpl $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) > $(@F) $(LIBDYNNAME) : ../$(LIBNAME) osx.def $(CC) $(CFLAGS) -all_load -headerpad_max_install_names -install_name $(CURDIR)/../$(LIBDYNNAME) -dynamiclib -o ../$(LIBDYNNAME) $< -Wl,-exported_symbols_list,osx.def $(FEXTRALIB) @@ -191,23 +195,23 @@ static : ../$(LIBNAME) rm -f goto.$(SUFFIX) linux.def : gensymbol ../Makefile.system ../getarch.c - perl ./gensymbol linux $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) > $(@F) + perl ./gensymbol linux $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) > $(@F) osx.def : gensymbol ../Makefile.system ../getarch.c - perl ./gensymbol osx $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) > $(@F) + perl ./gensymbol osx $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) > $(@F) aix.def : gensymbol ../Makefile.system ../getarch.c - perl ./gensymbol aix $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) > $(@F) + perl ./gensymbol aix $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) > $(@F) symbol.S : gensymbol - perl ./gensymbol win2kasm noarch dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) > symbol.S + perl ./gensymbol win2kasm noarch dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) > symbol.S test : linktest.c $(CC) $(CFLAGS) $(LDFLAGS) -w -o linktest linktest.c ../$(LIBSONAME) -lm && echo OK. rm -f linktest linktest.c : gensymbol ../Makefile.system ../getarch.c - perl ./gensymbol linktest $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) > linktest.c + perl ./gensymbol linktest $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) > linktest.c clean :: @rm -f *.def *.dylib __.SYMDEF* diff --git a/exports/gensymbol b/exports/gensymbol index 7076412..e154b26 100644 --- a/exports/gensymbol +++ b/exports/gensymbol @@ -2675,7 +2675,10 @@ #These function may need 2 underscores. @lapack_embeded_underscore_objs=(xerbla_array, chla_transtype,); -if ($ARGV[5] == 1) { +if ($ARGV[8] == 1) { + #ONLY_CBLAS=1 + @underscore_objs = (@misc_underscore_objs); +} elsif ($ARGV[5] == 1) { #NO_LAPACK=1 @underscore_objs = (@blasobjs, @misc_underscore_objs); } elsif (-d "../lapack-3.1.1" || -d "../lapack-3.4.0" || -d "../lapack-3.4.1" || @@ -2695,6 +2698,12 @@ if ($ARGV[5] == 1) { @underscore_objs = (@blasobjs, @lapackobjs, @misc_underscore_objs); } +if ($ARGV[8] == 1) { + #ONLY_CBLAS=1 + @gemm3mobjs=(); + @exblasobjs=(); +} + if ($ARGV[3] == 1){ @underscore_objs = (@underscore_objs, @exblasobjs); }; if ($ARGV[1] eq "x86_64"){ @underscore_objs = (@underscore_objs, @gemm3mobjs); }; diff --git a/interface/Makefile b/interface/Makefile index 9389220..a700e65 100644 --- a/interface/Makefile +++ b/interface/Makefile @@ -786,7 +786,7 @@ endif qgemv.$(SUFFIX) qgemv.$(PSUFFIX): gemv.c $(CC) -c $(CFLAGS) -o $(@F) $< - + ifndef USE_NETLIB_GEMV cgemv.$(SUFFIX) cgemv.$(PSUFFIX): zgemv.c $(CC) -c $(CFLAGS) -o $(@F) $<