Fixed #88. Build LAPACKE: C Interface to LAPACK.

This commit is contained in:
Zaheer Chothia 2012-04-07 10:40:46 +02:00 committed by Xianyi Zhang
parent 435420d6d5
commit 78914475ae
7 changed files with 2371 additions and 63 deletions

View File

@ -26,10 +26,10 @@ endif
SUBDIRS_ALL = $(SUBDIRS) test ctest utest exports benchmark ../laswp ../bench
.PHONY : all libs netlib test ctest shared install
.PHONY : all libs netlib lapacke test ctest shared install
.NOTPARALLEL : all libs prof lapack-test install
all :: libs netlib tests shared
all :: libs netlib lapacke tests shared
@echo
@echo " OpenBLAS build complete."
@echo
@ -203,31 +203,54 @@ ifeq ($(NO_LAPACK), 1)
netlib :
else
netlib : lapack-3.4.0 patch.for_lapack-3.4.0 lapack-3.4.0/make.inc
netlib : lapack-3.4.0 patch.for_lapack-3.4.0 $(NETLIB_LAPACK_DIR)/make.inc
ifndef NOFORTRAN
-@$(MAKE) -C lapack-3.4.0 lapacklib
-@$(MAKE) -C $(NETLIB_LAPACK_DIR) lapacklib
endif
endif
prof_lapack : lapack-3.4.0 lapack-3.4.0/make.inc
-@$(MAKE) -C lapack-3.4.0 lapack_prof
ifeq ($(NO_LAPACKE), 1)
lapacke :
lapack-3.4.0/make.inc :
else
lapacke : lapack-3.4.0 $(NETLIB_LAPACK_DIR)/lapacke/make.inc
ifndef NOFORTRAN
-@echo "FORTRAN = $(FC)" > lapack-3.4.0/make.inc
-@echo "OPTS = $(FFLAGS)" >> lapack-3.4.0/make.inc
-@echo "POPTS = $(FPFLAGS)" >> lapack-3.4.0/make.inc
-@echo "NOOPT = $(FFLAGS) -O0" >> lapack-3.4.0/make.inc
-@echo "PNOOPT = $(FPFLAGS) -O0" >> lapack-3.4.0/make.inc
-@echo "LOADOPTS = $(FFLAGS) $(EXTRALIB)" >> lapack-3.4.0/make.inc
-@echo "ARCH = $(AR)" >> lapack-3.4.0/make.inc
-@echo "RANLIB = $(RANLIB)" >> lapack-3.4.0/make.inc
-@echo "LAPACKLIB = ../$(LIBNAME)" >> lapack-3.4.0/make.inc
-@echo "LAPACKLIB_P = ../$(LIBNAME_P)" >> lapack-3.4.0/make.inc
-@echo "SUFFIX = $(SUFFIX)" >> lapack-3.4.0/make.inc
-@echo "PSUFFIX = $(PSUFFIX)" >> lapack-3.4.0/make.inc
# -@echo "CEXTRALIB = $(CEXTRALIB)" >> lapack-3.4.0/make.inc
-@cat make.inc >> lapack-3.4.0/make.inc
-@$(MAKE) -C $(NETLIB_LAPACK_DIR)/lapacke
endif
endif
prof_lapack : lapack-3.4.0 $(NETLIB_LAPACK_DIR)/make.inc
-@$(MAKE) -C $(NETLIB_LAPACK_DIR) lapack_prof
$(NETLIB_LAPACK_DIR)/make.inc :
ifndef NOFORTRAN
-@echo "FORTRAN = $(FC)" > $(NETLIB_LAPACK_DIR)/make.inc
-@echo "OPTS = $(FFLAGS)" >> $(NETLIB_LAPACK_DIR)/make.inc
-@echo "POPTS = $(FPFLAGS)" >> $(NETLIB_LAPACK_DIR)/make.inc
-@echo "NOOPT = $(FFLAGS) -O0" >> $(NETLIB_LAPACK_DIR)/make.inc
-@echo "PNOOPT = $(FPFLAGS) -O0" >> $(NETLIB_LAPACK_DIR)/make.inc
-@echo "LOADOPTS = $(FFLAGS) $(EXTRALIB)" >> $(NETLIB_LAPACK_DIR)/make.inc
-@echo "ARCH = $(AR)" >> $(NETLIB_LAPACK_DIR)/make.inc
-@echo "RANLIB = $(RANLIB)" >> $(NETLIB_LAPACK_DIR)/make.inc
-@echo "LAPACKLIB = ../$(LIBNAME)" >> $(NETLIB_LAPACK_DIR)/make.inc
-@echo "LAPACKLIB_P = ../$(LIBNAME_P)" >> $(NETLIB_LAPACK_DIR)/make.inc
-@echo "SUFFIX = $(SUFFIX)" >> $(NETLIB_LAPACK_DIR)/make.inc
-@echo "PSUFFIX = $(PSUFFIX)" >> $(NETLIB_LAPACK_DIR)/make.inc
# -@echo "CEXTRALIB = $(CEXTRALIB)" >> $(NETLIB_LAPACK_DIR)/make.inc
-@cat make.inc >> $(NETLIB_LAPACK_DIR)/make.inc
endif
$(NETLIB_LAPACK_DIR)/lapacke/make.inc :
ifndef NOFORTRAN
-@echo "CC = $(CC)" > $(NETLIB_LAPACK_DIR)/lapacke/make.inc
-@echo "CFLAGS = $(CFLAGS)" >> $(NETLIB_LAPACK_DIR)/lapacke/make.inc
-@echo "LINKER = $(FC)" >> $(NETLIB_LAPACK_DIR)/lapacke/make.inc
-@echo "LDFLAGS = $(FFLAGS) $(EXTRALIB)" >> $(NETLIB_LAPACK_DIR)/lapacke/make.inc
-@echo "LAPACKE = ../../$(LIBNAME)" >> $(NETLIB_LAPACK_DIR)/lapacke/make.inc
-@echo "LIBS = $(EXTRALIB)" >> $(NETLIB_LAPACK_DIR)/lapacke/make.inc
-@echo "ARCH = $(AR)" >> $(NETLIB_LAPACK_DIR)/lapacke/make.inc
-@echo "ARCHFLAGS = -ru" >> $(NETLIB_LAPACK_DIR)/lapacke/make.inc
-@echo "RANLIB = $(RANLIB)" >> $(NETLIB_LAPACK_DIR)/lapacke/make.inc
endif
lapack-3.4.0 : lapack-3.4.0.tgz
@ -235,9 +258,9 @@ ifndef NOFORTRAN
ifndef NO_LAPACK
@if test `$(MD5SUM) lapack-3.4.0.tgz | $(AWK) '{print $$1}'` = 02d5706ec03ba885fc246e5fa10d8c70; then \
echo $(TAR) zxf $< ;\
$(TAR) zxf $< && (cd lapack-3.4.0; $(PATCH) -p1 < ../patch.for_lapack-3.4.0) ;\
$(TAR) zxf $< && (cd $(NETLIB_LAPACK_DIR); $(PATCH) -p1 < ../patch.for_lapack-3.4.0) ;\
else \
rm -rf lapack-3.4.0 ;\
rm -rf $(NETLIB_LAPACK_DIR) ;\
echo " Cannot download lapack-3.4.0.tgz or the MD5 check sum is wrong (Please use orignal)."; \
exit 1; \
fi
@ -267,19 +290,19 @@ endif
lapack-timing : lapack-3.4.0 large.tgz timing.tgz
ifndef NOFORTRAN
(cd lapack-3.4.0; $(TAR) zxf ../timing.tgz TIMING)
(cd lapack-3.4.0/TIMING; $(TAR) zxf ../../large.tgz )
make -C lapack-3.4.0 tmglib
make -C lapack-3.4.0/TIMING
(cd $(NETLIB_LAPACK_DIR); $(TAR) zxf ../timing.tgz TIMING)
(cd $(NETLIB_LAPACK_DIR)/TIMING; $(TAR) zxf ../../large.tgz )
make -C $(NETLIB_LAPACK_DIR) tmglib
make -C $(NETLIB_LAPACK_DIR)/TIMING
endif
lapack-test :
$(MAKE) -C lapack-3.4.0 tmglib
$(MAKE) -C lapack-3.4.0/TESTING xeigtstc xeigtstd xeigtsts xeigtstz xlintstc xlintstd xlintstds xlintsts xlintstz xlintstzc
@rm -f lapack-3.4.0/TESTING/*.out
$(MAKE) -j 1 -C lapack-3.4.0/TESTING
$(GREP) failed lapack-3.4.0/TESTING/*.out
$(MAKE) -C $(NETLIB_LAPACK_DIR) tmglib
$(MAKE) -C $(NETLIB_LAPACK_DIR)/TESTING xeigtstc xeigtstd xeigtsts xeigtstz xlintstc xlintstd xlintstds xlintsts xlintstz xlintstzc
@rm -f $(NETLIB_LAPACK_DIR)/TESTING/*.out
$(MAKE) -j 1 -C $(NETLIB_LAPACK_DIR)/TESTING
$(GREP) failed $(NETLIB_LAPACK_DIR)/TESTING/*.out
dummy :
@ -298,9 +321,9 @@ clean ::
@$(MAKE) -C reference clean
@rm -f *.$(LIBSUFFIX) *.so *~ *.exe getarch getarch_2nd *.dll *.lib *.$(SUFFIX) *.dwf $(LIBPREFIX).$(LIBSUFFIX) $(LIBPREFIX)_p.$(LIBSUFFIX) $(LIBPREFIX).so.$(MAJOR_VERSION) *.lnk myconfig.h
@rm -f Makefile.conf config.h Makefile_kernel.conf config_kernel.h st* *.dylib
@if test -d lapack-3.4.0; then \
echo deleting lapack-3.4.0; \
rm -rf lapack-3.4.0 ;\
@if test -d $(NETLIB_LAPACK_DIR); then \
echo deleting $(NETLIB_LAPACK_DIR); \
rm -rf $(NETLIB_LAPACK_DIR) ;\
fi
@rm -f *.grd Makefile.conf_last config_last.h
@echo Done.

View File

@ -35,6 +35,13 @@ install : lib.grd
@echo Generating cblas.h in $(OPENBLAS_INCLUDE_DIR)
@sed 's/common/openblas_config/g' cblas.h > $(OPENBLAS_INCLUDE_DIR)/cblas.h
ifndef NO_LAPACKE
@echo Copying LAPACKE header files to $(OPENBLAS_LIBRARY_DIR)
@cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke.h $(OPENBLAS_INCLUDE_DIR)/lapacke.h
@cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_config.h $(OPENBLAS_INCLUDE_DIR)/lapacke_config.h
@cp $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_utils.h $(OPENBLAS_INCLUDE_DIR)/lapacke_utils.h
endif
#for install static library
@echo Copy the static library to $(OPENBLAS_LIBRARY_DIR)
@cp $(LIBNAME) $(OPENBLAS_LIBRARY_DIR)

View File

@ -51,6 +51,9 @@ VERSION = 0.1.0
# If you don't need LAPACK, please comment it in.
# NO_LAPACK = 1
# If you don't need LAPACKE (C Interface to LAPACK), please comment it in.
# NO_LAPACKE = 1
# If you want to use legacy threaded Level 3 implementation.
# USE_SIMPLE_THREADED_LEVEL3 = 1

View File

@ -9,6 +9,10 @@ ifndef TOPDIR
TOPDIR = .
endif
ifndef NETLIB_LAPACK_DIR
NETLIB_LAPACK_DIR = $(TOPDIR)/lapack-3.4.0
endif
# Default C compiler
CC = gcc
@ -536,6 +540,10 @@ ifeq ($(NO_LAPACK), 1)
CCOMMON_OPT += -DNO_LAPACK
endif
ifeq ($(NO_LAPACKE), 1)
CCOMMON_OPT += -DNO_LAPACKE
endif
ifdef SMP
CCOMMON_OPT += -DSMP_SERVER

View File

@ -76,13 +76,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) > $(@F)
perl ./gensymbol win2k $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) > $(@F)
libgoto2_shared.def : gensymbol
perl ./gensymbol win2k $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) > $(@F)
perl ./gensymbol win2k $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) > $(@F)
libgoto_hpl.def : gensymbol
perl ./gensymbol win2khpl $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) > $(@F)
perl ./gensymbol win2khpl $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) > $(@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)
@ -163,23 +163,23 @@ static : ../$(LIBNAME)
rm -f goto.$(SUFFIX)
linux.def : gensymbol ../Makefile.system ../getarch.c
perl ./gensymbol linux $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) > $(@F)
perl ./gensymbol linux $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) > $(@F)
osx.def : gensymbol ../Makefile.system ../getarch.c
perl ./gensymbol osx $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) > $(@F)
perl ./gensymbol osx $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) > $(@F)
aix.def : gensymbol ../Makefile.system ../getarch.c
perl ./gensymbol aix $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) > $(@F)
perl ./gensymbol aix $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) > $(@F)
symbol.S : gensymbol
perl ./gensymbol win2kasm noarch dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) > symbol.S
perl ./gensymbol win2kasm noarch dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) > symbol.S
test : linktest.c
$(CC) $(CFLAGS) -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) > linktest.c
perl ./gensymbol linktest $(ARCH) $(BU) $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) > linktest.c
clean ::
@rm -f *.def *.dylib __.SYMDEF*

File diff suppressed because it is too large Load Diff

View File

@ -887,3 +887,158 @@ diff -ruN lapack-3.4.0.old/TESTING/LIN/Makefile lapack-3.4.0/TESTING/LIN/Makefil
../xlintsts: xlintsts
mv xlintsts $@
diff -ruN lapack-3.4.0.old/lapacke/make.inc lapack-3.4.0/lapacke/make.inc
--- lapack-3.4.0.old/lapacke/make.inc 2011-11-09 23:56:15 +0100
+++ lapack-3.4.0/lapacke/make.inc 1970-01-01 01:00:00 +0100
@@ -1,66 +0,0 @@
-##############################################################################
-# Copyright (c) 2010, Intel Corp.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# * Redistributions of source code must retain the above copyright notice,
-# this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Intel Corporation nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-# THE POSSIBILITY OF SUCH DAMAGE.
-##############################################################################
-# Contents: Native C interface to LAPACK
-# Author: Intel Corporation
-# September, 2010
-##############################################################################
-# This is the make.inc example. The following settings are used:
-#
-# Compiler: gcc
-# Configuration file: turned off (default)
-# Complex types: C99 (default)
-# Name pattern: mixed case (default)
-# (64-bit) Data model: LP64 (default)
-#
-# Basic include options.
-# CC is the C compiler, normally invoked with options CFLAGS.
-# LINKER is the linker, invoked with LDFLAGS.
-#
-# If libraries lapack.a and blas.a are built with
-# - ifort, set: LINKER = ifort
-# LDFLAGS = -nofor-main
-# - gfortran, set: LINKER = gfortran
-#
-CC = gcc
-CFLAGS =
-LINKER = gfortran
-LDFLAGS =
-#
-# The name of the libraries to be created/linked to
-# Ensure that the libraries have the same data model (LP64/ILP64).
-#
-LAPACKE = lapacke.a
-LIBS = /Users/julie/Documents/Boulot/lapack-dev/lapack/trunk/lapack_LINUX.a \
- /Users/julie/Documents/Boulot/lapack-dev/lapack/trunk/blas_LINUX.a -lm
-# The archiver and the flag(s) to use when building archive (library)
-# If your system has no ranlib, set RANLIB = echo.
-#
-ARCH = ar
-ARCHFLAGS = cr
-RANLIB = ranlib
diff -ruN lapack-3.4.0.old/lapacke/make.inc.example lapack-3.4.0/lapacke/make.inc.example
--- lapack-3.4.0.old/lapacke/make.inc.example 1970-01-01 01:00:00 +0100
+++ lapack-3.4.0/lapacke/make.inc.example 2011-11-09 23:56:15 +0100
@@ -0,0 +1,66 @@
+##############################################################################
+# Copyright (c) 2010, Intel Corp.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Intel Corporation nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+##############################################################################
+# Contents: Native C interface to LAPACK
+# Author: Intel Corporation
+# September, 2010
+##############################################################################
+# This is the make.inc example. The following settings are used:
+#
+# Compiler: gcc
+# Configuration file: turned off (default)
+# Complex types: C99 (default)
+# Name pattern: mixed case (default)
+# (64-bit) Data model: LP64 (default)
+#
+# Basic include options.
+# CC is the C compiler, normally invoked with options CFLAGS.
+# LINKER is the linker, invoked with LDFLAGS.
+#
+# If libraries lapack.a and blas.a are built with
+# - ifort, set: LINKER = ifort
+# LDFLAGS = -nofor-main
+# - gfortran, set: LINKER = gfortran
+#
+CC = gcc
+CFLAGS =
+LINKER = gfortran
+LDFLAGS =
+#
+# The name of the libraries to be created/linked to
+# Ensure that the libraries have the same data model (LP64/ILP64).
+#
+LAPACKE = lapacke.a
+LIBS = /Users/julie/Documents/Boulot/lapack-dev/lapack/trunk/lapack_LINUX.a \
+ /Users/julie/Documents/Boulot/lapack-dev/lapack/trunk/blas_LINUX.a -lm
+# The archiver and the flag(s) to use when building archive (library)
+# If your system has no ranlib, set RANLIB = echo.
+#
+ARCH = ar
+ARCHFLAGS = cr
+RANLIB = ranlib
diff -ruN lapack-3.4.0.old/lapacke/src/Makefile lapack-3.4.0/lapacke/src/Makefile
--- lapack-3.4.0.old/lapacke/src/Makefile 2011-11-09 23:56:15 +0100
+++ lapack-3.4.0/lapacke/src/Makefile 2012-04-06 13:57:50 +0200
@@ -40,7 +40,8 @@
all: lib
lib: $(OBJ_FILES)
- $(ARCH) $(ARCHFLAGS) ../$(LAPACKE) $(OBJ_FILES)
+ # http://hackage.haskell.org/trac/gtk2hs/ticket/1146
+ echo $(OBJ_FILES) | xargs --max-args=100 $(ARCH) $(ARCHFLAGS) ../$(LAPACKE)
$(RANLIB) ../$(LAPACKE)
.c.o: