Skip to content

Make gfortran link libomp for clang in the tests; avoid two typical gotchas with NOFORTRAN #1629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 20, 2018
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
28 changes: 21 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ ifeq ($(BUILD_RELAPACK), 1)
RELA = re_lapack
endif

ifeq ($(NO_FORTRAN), 1)
define NOFORTRAN
1
endef
define NO_LAPACK
1
endef
export NOFORTRAN
export NO_LAPACK
endif

LAPACK_NOOPT := $(filter-out -O0 -O1 -O2 -O3 -Ofast,$(LAPACK_FFLAGS))

SUBDIRS_ALL = $(SUBDIRS) test ctest utest exports benchmark ../laswp ../bench
Expand All @@ -47,7 +58,7 @@ endif
endif

@echo " C compiler ... $(C_COMPILER) (command line : $(CC))"
ifndef NOFORTRAN
ifneq ($(NOFORTRAN), $(filter-out $(NOFORTRAN), 1 2))
@echo " Fortran compiler ... $(F_COMPILER) (command line : $(FC))"
endif
ifneq ($(OSNAME), AIX)
Expand Down Expand Up @@ -108,7 +119,7 @@ endif
endif

tests :
ifndef NOFORTRAN
ifneq ($(NOFORTRAN), $(filter-out $(NOFORTRAN), 1 2))
touch $(LIBNAME)
ifndef NO_FBLAS
$(MAKE) -C test all
Expand Down Expand Up @@ -210,7 +221,7 @@ netlib :

else
netlib : lapack_prebuild
ifndef NOFORTRAN
ifneq ($(NOFORTRAN), $(filter-out $(NOFORTRAN), 1 2))
@$(MAKE) -C $(NETLIB_LAPACK_DIR) lapacklib
@$(MAKE) -C $(NETLIB_LAPACK_DIR) tmglib
endif
Expand All @@ -231,7 +242,10 @@ prof_lapack : lapack_prebuild
@$(MAKE) -C $(NETLIB_LAPACK_DIR) lapack_prof

lapack_prebuild :
ifndef NOFORTRAN
$(info filter value of NOFORTRAN is:)
$(info x$(filter-out $(NOFORTRAN), 1 2)x)

ifneq ($(NOFORTRAN), $(filter-out $(NOFORTRAN), 1 2))
-@echo "FORTRAN = $(FC)" > $(NETLIB_LAPACK_DIR)/make.inc
-@echo "OPTS = $(LAPACK_FFLAGS)" >> $(NETLIB_LAPACK_DIR)/make.inc
-@echo "POPTS = $(LAPACK_FPFLAGS)" >> $(NETLIB_LAPACK_DIR)/make.inc
Expand Down Expand Up @@ -274,21 +288,21 @@ endif
endif

large.tgz :
ifndef NOFORTRAN
ifneq ($(NOFORTRAN), $(filter $(NOFORTRAN), 1 2))
if [ ! -a $< ]; then
-wget http://www.netlib.org/lapack/timing/large.tgz;
fi
endif

timing.tgz :
ifndef NOFORTRAN
ifneq ($(NOFORTRAN), $(filter $(NOFORTRAN), 1 2))
if [ ! -a $< ]; then
-wget http://www.netlib.org/lapack/timing/timing.tgz;
fi
endif

lapack-timing : large.tgz timing.tgz
ifndef NOFORTRAN
ifneq ($(NOFORTRAN), $(filter $(NOFORTRAN), 1 2))
(cd $(NETLIB_LAPACK_DIR); $(TAR) zxf ../timing.tgz TIMING)
(cd $(NETLIB_LAPACK_DIR)/TIMING; $(TAR) zxf ../../large.tgz )
$(MAKE) -C $(NETLIB_LAPACK_DIR)/TIMING
Expand Down
8 changes: 7 additions & 1 deletion ctest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,13 @@ clean ::
rm -f x*

FLDFLAGS = $(FFLAGS:-fPIC=) $(LDFLAGS)
CEXTRALIB =
ifeq ($(USE_OPENMP), 1)
ifeq ($(F_COMPILER), GFORTRAN)
ifeq ($(C_COMPILER), CLANG)
CEXTRALIB = -lomp
endif
endif
endif

# Single real
xscblat1: $(stestl1o) c_sblat1.o $(TOPDIR)/$(LIBNAME)
Expand Down
9 changes: 7 additions & 2 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,13 @@ endif


FLDFLAGS = $(FFLAGS:-fPIC=) $(LDFLAGS)
CEXTRALIB =

ifeq ($(USE_OPENMP), 1)
ifeq ($(F_COMPILER), GFORTRAN)
ifeq ($(C_COMPILER), CLANG)
CEXTRALIB = -lomp
endif
endif
endif

sblat1 : sblat1.$(SUFFIX) ../$(LIBNAME)
$(FC) $(FLDFLAGS) -o sblat1 sblat1.$(SUFFIX) ../$(LIBNAME) $(EXTRALIB) $(CEXTRALIB)
Expand Down