Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 72 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
check-env check-env-config check-env-fragments \
flat-headers \
test \
install-headers install-libs install-lib-symlinks \
clean cleanmk cleanh cleanlib cleanleaves distclean \
install-headers install-libs install-lib-symlinks install-netlib-tests\
clean cleanmk cleanh cleanlib cleanleaves distclean clean-netlib-tests \
install \
uninstall-libs uninstall-lib-symlinks uninstall-headers

Expand Down Expand Up @@ -355,7 +355,12 @@ CFLAGS_NOOPT := $(CFLAGS_NOOPT) $(INCLUDE_PATHS)
CPPFLAGS := $(CPPFLAGS) $(INCLUDE_PATHS)
FFLAGS := $(FFLAGS) $(INCLUDE_PATHS)


SCRIPTS_PATH := $(DIST_PATH)/src/map/common/lapacksrc/scripts
FDEPS_PATH := $(DIST_PATH)/src/map/common/lapacksrc/fortran
FDEPS1 := $(FDEPS_PATH)/la_constants.f90
FDEPS2 := $(FDEPS_PATH)/la_xisnan.F90
FDEPS := $(FDEPS1) $(FDEPS2)
FORT_EXT := %.f %.F %.f90 %.F90

#
# --- Library object definitions -----------------------------------------------
Expand Down Expand Up @@ -383,8 +388,8 @@ MK_MAP_LAPACK2FLAMEC_OBJS := $(patsubst $(SRC_PATH)/%.c, $(BAS
MK_MAP_LAPACK2FLASH_OBJS := $(patsubst $(SRC_PATH)/%.c, $(BASE_OBJ_PATH)/%.o, \
$(filter %.c, $(MK_MAP_LAPACK2FLASH_SRC)))

MK_MAP_FORTRAN_OBJS := $(patsubst $(SRC_PATH)/%.f, $(BASE_OBJ_PATH)/%.o, \
$(filter %.f, $(MK_MAP_FORTRAN_SRC)))
MK_MAP_FORTRAN_OBJS := $(foreach F_EXT, $(FORT_EXT), $(patsubst $(SRC_PATH)/$(F_EXT), $(BASE_OBJ_PATH)/%.o, \
$(filter $(FORT_EXT), $(filter-out $(FDEPS), $(MK_MAP_FORTRAN_SRC)))))

MK_MAP_F2C_OBJS := $(patsubst $(SRC_PATH)/%.c, $(BASE_OBJ_PATH)/%.o, \
$(filter %.c, $(MK_MAP_F2C_SRC)))
Expand Down Expand Up @@ -469,11 +474,11 @@ all: libs

libs: libflame

install: libs install-libs install-lib-symlinks install-headers
install: libs install-libs install-lib-symlinks install-headers install-netlib-tests

uninstall: uninstall-libs uninstall-lib-symlinks uninstall-headers

clean: cleanh cleanobj cleanlib
clean: cleanh cleanobj cleanlib clean-netlib-tests



Expand Down Expand Up @@ -572,12 +577,37 @@ endif

# Default Fortran compilation rules
# Might need -fallow-argument-mismatch for newer gfortran (untested)
$(BASE_OBJ_PATH)/%.o: $(SRC_PATH)/%.f $(CONFIG_MK_FILE) $(HEADERS_TO_FLATTEN)
define fortran_rule
$$(BASE_OBJ_PATH)/%.o: $$(SRC_PATH)/$1 $$(CONFIG_MK_FILE) $$(HEADERS_TO_FLATTEN) $$(BASE_OBJ_PATH)/la_xisnan.mod
ifeq ($$(ENABLE_VERBOSE),yes)
$(FC) -cpp -c $$< -o $$@
else
@echo "Compiling $$<"
@$(FC) -cpp -c $$< -o $$@
endif
ifeq ($$(FLA_ENABLE_MAX_ARG_LIST_HACK),yes)
@echo $$@ >> $$(AR_OBJ_LIST_FILE)
endif
endef
$(foreach FEXT, $(FORT_EXT), $(eval $(call fortran_rule,$(FEXT))))

$(BASE_OBJ_PATH)/la_xisnan.mod: $(FDEPS2) $(BASE_OBJ_PATH)/la_constants.mod
ifeq ($(ENABLE_VERBOSE),yes)
$(F77) -cpp -c $< -o $@
$(FC) -cpp -c $< -o $@
else
@echo "Compiling $<"
@$(F77) -cpp -c $< -o $@
@echo "Building $<"
@$(FC) -cpp -c $< -o $@
endif
ifeq ($(FLA_ENABLE_MAX_ARG_LIST_HACK),yes)
@echo $@ >> $(AR_OBJ_LIST_FILE)
endif

$(BASE_OBJ_PATH)/la_constants.mod: $(FDEPS1)
ifeq ($(ENABLE_VERBOSE),yes)
$(FC) -cpp -c $< -o $@
else
@echo "Building $<"
@$(FC) -cpp -c $< -o $@
endif
ifeq ($(FLA_ENABLE_MAX_ARG_LIST_HACK),yes)
@echo $@ >> $(AR_OBJ_LIST_FILE)
Expand Down Expand Up @@ -784,6 +814,27 @@ else
@$(MV) $(@F) $(INSTALL_LIBDIR)/
endif

# --- Install-netlibs-test dir ---

install-netlib-tests:
ifeq ($(FLA_ENABLE_LEGACY_LAPACK),no)
ifeq ($(FLA_ENABLE_LAPACK2FLAME),yes)
ifeq ($(ENABLE_VERBOSE),yes)
$(SCRIPTS_PATH)/regen-files.sh build_test
else
@echo "Installing netlib-tests"
@$(SCRIPTS_PATH)/regen-files.sh build_test
endif
endif
ifeq ($(FLA_ENABLE_LAPACK2FLASH),yes)
ifeq ($(ENABLE_VERBOSE),yes)
$(SCRIPTS_PATH)/regen-files.sh build_test
else
@echo "Installing netlib-tests"
@$(SCRIPTS_PATH)/regen-files.sh build_test
endif
endif
endif

# --- Clean rules ---

Expand Down Expand Up @@ -891,6 +942,16 @@ else
endif
endif

clean-netlib-tests:
ifeq ($(IS_CONFIGURED),yes)
ifeq ($(ENABLE_VERBOSE),yes)
$(SCRIPTS_PATH)/regen-files.sh clean_test
else
@echo "Removing netlib-tests"
@$(SCRIPTS_PATH)/regen-files.sh clean_test
endif
endif

# --- Uninstall rules ---

# NOTE: We can't write these uninstall rules directly in terms of targets
Expand Down
2 changes: 1 addition & 1 deletion build/config/leaf_list
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ lapack2flamec:c
lapack2flash:c
f2c:c
lapackcheck:c
fortran:f
fortran:f,F,f90,F90
install:c
23 changes: 23 additions & 0 deletions netlib-test/build/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
This is a modified netlibs test suite that is using either the lapack2flame or lapack2flash interface.
This test suite is only built by the libflame makefile if one of these options are selected.
This test is removed in a 'make clean' is run on libflame

Below is an example of how to run this test:
#ln -s ../../lib/x86_64-unknown-linux-gnu/libflame.so liblapack.so
#ln -s PATH_TO_YOUR_BLAS/libblis.so libblas.so
#export LD_LIBRARY_PATH=LOCATION_OF_YOUR_BLAS:LOCATION_OF_YOUR_LAPACK
#make -j

This should result with something like the following results:

--> LAPACK TESTING SUMMARY <--
Processing LAPACK Testing output found in the TESTING directory
SUMMARY nb test run numerical error other error
================ =========== ================= ================
REAL 1075089 2767 (0.257%) 0 (0.000%)
DOUBLE PRECISION 1198641 2694 (0.225%) 1 (0.000%)
COMPLEX 650845 169 (0.026%) 0 (0.000%)
COMPLEX16 783228 143 (0.018%) 0 (0.000%)

--> ALL PRECISIONS 3707803 5773 (0.156%) 1 (0.000%)

12 changes: 6 additions & 6 deletions netlib-test/build/SRC-Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

LAPACK_PRES := $(shell if [ -e ../liblapack.a ]; then echo "yes"; else echo "no"; fi)
BLAS_PRES := $(shell if [ -e ../libblas.a ]; then echo "yes"; else echo "no"; fi)
LAPACK_PRES := $(shell if [ -e ../liblapack.so ]; then echo "yes"; else echo "no"; fi)
BLAS_PRES := $(shell if [ -e ../libblas.so ]; then echo "yes"; else echo "no"; fi)

all:
ifeq ($(LAPACK_PRES),yes)
$(info Found 'liblapack.a'.)
$(info Found 'liblapack.so'.)
else
$(error Missing liblapack.a. Cannot continue. Please create a symlink named 'liblapack.a' and then re-run 'make'.)
$(error Missing liblapack.so. Cannot continue. Please create a symlink named 'liblapack.so' and then re-run 'make'.)
endif
ifeq ($(BLAS_PRES),yes)
$(info Found 'libblas.a'.)
$(info Found 'libblas.so'.)
else
$(error Missing libblas.a. Cannot continue. Please create a symlink named 'libblas.a' and then re-run 'make'.)
$(error Missing libblas.so. Cannot continue. Please create a symlink named 'libblas.so' and then re-run 'make'.)
endif
@echo "Netlib LAPACK test suite prerequisites present."

Expand Down
32 changes: 30 additions & 2 deletions netlib-test/create_new_testdir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ main()
# to libflame).
#cp -p ${netlib_path}/make.inc.example ./${testdir_new}/make.inc
cat ${netlib_path}/make.inc.example \
| sed -e "s/liblapack\.a/liblapack\.a -lpthread/g" \
| sed -e "s/librefblas\.a/libblas\.a/g" \
| sed -e "s/liblapack\.a/liblapack\.so/g" \
| sed -e "s/librefblas\.a/libblas\.so/g" \
| sed -e "s/libtmglib\.a/libtmglib\.so/g" \
| sed -e "s/AR = ar/AR = \$(CC)/g" \
| sed -e "s/ARFLAGS = cr/ARFLAGS = -lm -shared/g" \
| sed -e "s/RANLIB = ranlib/RANLIB = echo/g" \
> ./${testdir_new}/make.inc

echo "Creating ./${testdir_new}/SRC"
Expand All @@ -66,6 +70,9 @@ main()
mkdir ./${testdir_new}/SRC
cp ./build/SRC-Makefile ./${testdir_new}/SRC/Makefile

# Adding README
cp ./build/README ./${testdir_new}/

# Make a dummy 'SRC/VARIANTS' directory with a dummy Makefile.
mkdir ./${testdir_new}/SRC/VARIANTS
cp ./build/SRC-VARIANTS-Makefile ./${testdir_new}/SRC/VARIANTS/Makefile
Expand Down Expand Up @@ -103,6 +110,27 @@ main()

sed -e "${sed_expr}" ${ddrvsg_in} > ${ddrvsg_ou}

# Update makefiles to have the correct path
# There was an issue where the path is given during linking
# as a relitive path. Then when run, it is executed from a different
# dir. This would cause it to fail
for make_file in BLAS/SRC/Makefile INSTALL/Makefile TESTING/Makefile TESTING/EIG/Makefile TESTING/LIN/Makefile TESTING/MATGEN/Makefile
do
sed -i 's/TOPSRCDIR = ../TOPSRCDIR = ${CURDIR}\/../' ${testdir_new}/$make_file
done

# Adding the '-o' flag needed to link
sed -i 's/$(AR) $(ARFLAGS) $@ $^/$(AR) $(ARFLAGS) -o $@ $^/' ${testdir_new}/TESTING/MATGEN/Makefile

# Updating these to point to libflame instead of internal files
sed -i 's/testieee: tstiee.o .*/testieee: tstiee.o $(LAPACKLIB) $(BLASLIB)/' ${testdir_new}/INSTALL/Makefile

sed -i 's/schkaa.o: schkaa.F/schkaa.o: schkaa.F $(LAPACKLIB) $(BLASLIB)/' ${testdir_new}/TESTING/LIN/Makefile
sed -i 's/dchkaa.o: dchkaa.F/dchkaa.o: dchkaa.F $(LAPACKLIB) $(BLASLIB)/' ${testdir_new}/TESTING/LIN/Makefile
sed -i 's/cchkaa.o: cchkaa.F/cchkaa.o: cchkaa.F $(LAPACKLIB) $(BLASLIB)/' ${testdir_new}/TESTING/LIN/Makefile
sed -i 's/zchkaa.o: zchkaa.F/zchkaa.o: zchkaa.F $(LAPACKLIB) $(BLASLIB)/' ${testdir_new}/TESTING/LIN/Makefile
sed -i 's/$(FC) $(FFLAGS_DRV) -c -o $@ $</$(FC) $(FFLAGS_DRV) -c -o $@ $^/g' ${testdir_new}/TESTING/LIN/Makefile

# Exit peacefully.
return 0
}
Expand Down
4 changes: 0 additions & 4 deletions src/map/common/lapacksrc/netlib/install.list
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
ieeeck.f
ilaenv.f
iparmq.f
lsamen.f
xerbla.f
xerbla_array.f


Binary file not shown.
Binary file removed src/map/common/lapacksrc/netlib/lapack-3.5.0.tgz
Binary file not shown.
Loading