Add some compilation options to the Makefile.
It is now possible to use an external lapack version. If using directly the Makefile, use make pybinding USE_MKL=1 LINKER_FLAGS=-L$(MKLROOT) -lmkl_core -lmkl_intel_lp64 -lmkl_sequential If using the install script, you can choose to edit each option of the compilation
This commit is contained in:
parent
81bd65a001
commit
519c48c61f
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# vim: set ts=4 sw=4 sts noet mouse=a fdm=indent:
|
||||
|
||||
BYPASS="n"
|
||||
|
@ -10,6 +10,13 @@ DATE=$(date +%Y%m%d_%H%M%S)
|
|||
LOGFILE="${HOME}/msspec_install_${DATE}.log"
|
||||
GETOUTFILE=$(mktemp)
|
||||
|
||||
USE_MKL=0
|
||||
LINKER_FLAGS=""
|
||||
COMP=gfortran
|
||||
COMP_OPTS="-O2 -ffast-math -fno-automatic"
|
||||
DEBUG_MODE=0
|
||||
|
||||
|
||||
trap "abort_install" INT
|
||||
trap "error_exit" HUP QUIT ILL ABRT
|
||||
|
||||
|
@ -101,6 +108,7 @@ wrap () {
|
|||
log_message "================================================================================"
|
||||
log_message "$2"
|
||||
log_message "================================================================================"
|
||||
log_message "$1"
|
||||
if [ "$DEBUG" = y ]; then
|
||||
printf "%s...\n" "$2"
|
||||
(eval "$1" || echo $? >"${GETOUTFILE}") | tee -a "${LOGFILE}"
|
||||
|
@ -211,9 +219,38 @@ local_install () {
|
|||
# check dependencies
|
||||
wrap "check_dependencies" "Checking dependencies"
|
||||
|
||||
# build the Fortran code
|
||||
wrap "make pybinding VERBOSE=1" "Building Phagen and Spec Python dynamic library"
|
||||
# Do we have Lapack.
|
||||
log_message "Checking if lapack is installed..."
|
||||
pkg-config --exists lapack
|
||||
if test "$?" -ne 0; then
|
||||
HAS_LAPACK="n"
|
||||
log_message "No, will use included routines\n"
|
||||
else
|
||||
HAS_LAPACK="y"
|
||||
log_message "Ok\n"
|
||||
fi
|
||||
|
||||
if [ x"${HAS_LAPACK}" = xy ]; then
|
||||
read_yes_no "You have Lapack. Do you wish to link with installed lapack" "y"
|
||||
if [ x"${ANSWER}" = xy ]; then
|
||||
USE_MKL=1
|
||||
LINKER_FLAGS=`pkg-config --libs lapack`
|
||||
fi
|
||||
fi
|
||||
|
||||
# ask for expert options
|
||||
read_yes_no "Do you wish to edit compilation options" "n"
|
||||
if [ x"${ANSWER}" = xy ]; then
|
||||
read -ep "FORTRAN COMPILER...................> " -i "${COMP}" COMP
|
||||
read -ep "COMPILER OPTIONS...................> " -i "${COMP_OPTS}" COMP_OPTS
|
||||
read -ep "USE EXTERNAL LAPACK (0:no, 1:yes)..> " -i "${USE_MKL}" USE_MKL
|
||||
read -ep "LINKER FLAGS.......................> " -i "${LINKER_FLAGS}" LINKER_FLAGS
|
||||
read -ep "INCLUDE DEBUG SYMBOLS (0:no, 1:yes)> " -i "${DEBUG_MODE}" DEBUG_MODE
|
||||
fi
|
||||
|
||||
# build the Fortran code
|
||||
wrap "make pybinding VERBOSE=1 USE_MKL=${USE_MKL} LINKER_FLAGS=\"${LINKER_FLAGS}\" COMP=\"${COMP}\" COMP_OPTS=\"${COMP_OPTS}\" DEBUG=\"${DEBUG_MODE}\"" "Building Phagen and Spec Python dynamic library"
|
||||
exit
|
||||
# build the source distribution
|
||||
wrap "make sdist VERBOSE=1" "Building msspec python package"
|
||||
|
||||
|
|
|
@ -1,46 +1,52 @@
|
|||
COMP:=gfortran
|
||||
F2PY:=f2py3
|
||||
|
||||
COMP_OPTS:= -O2 -ffast-math
|
||||
COMP_OPTS:= -O2 -ffast-math -fno-automatic
|
||||
LINKER_FLAGS:=
|
||||
F2PY_OPTS:=
|
||||
|
||||
DEBUG:=0
|
||||
USE_MKL:=0
|
||||
|
||||
|
||||
|
||||
includes := -I./memalloc/ -I./cluster_gen/ -I./common_sub -I./renormalization
|
||||
includes += -I./phd_se_noso_nosp_nosym
|
||||
includes += -I./eig/common -I./eig/mi -I./eig/pw
|
||||
|
||||
memalloc_src:=memalloc/dim_mod.f memalloc/modules.f memalloc/allocation.f
|
||||
memalloc_obj:=$(patsubst %.f,%.o, $(memalloc_src))
|
||||
|
||||
cluster_gen_src:=$(wildcard cluster_gen/*.f)
|
||||
cluster_gen_obj:=$(patsubst %.f,%.o, $(cluster_gen_src))
|
||||
|
||||
common_sub_src:=$(wildcard common_sub/*.f)
|
||||
common_sub_obj:=$(patsubst %.f,%.o, $(common_sub_src))
|
||||
|
||||
renormalization_src:=$(wildcard renormalization/*.f)
|
||||
renormalization_obj:=$(patsubst %.f,%.o, $(renormalization_src))
|
||||
|
||||
phd_se_noso_nosp_nosym_src:=$(filter-out phd_se_noso_nosp_nosym/main.f, $(wildcard phd_se_noso_nosp_nosym/*.f))
|
||||
phd_se_noso_nosp_nosym_obj:=$(patsubst %.f,%.o, $(phd_se_noso_nosp_nosym_src))
|
||||
|
||||
phd_mi_noso_nosp_nosym_src:=$(filter-out phd_mi_noso_nosp_nosym/main.f, $(wildcard phd_mi_noso_nosp_nosym/*.f))
|
||||
phd_mi_noso_nosp_nosym_obj:=$(patsubst %.f,%.o, $(phd_mi_noso_nosp_nosym_src))
|
||||
|
||||
eig_common_src:=$(wildcard eig/common/*.f)
|
||||
eig_common_obj:=$(patsubst %.f,%.o, $(eig_common_src))
|
||||
|
||||
eig_mi_src:=$(filter-out eig/mi/main.f, $(wildcard eig/mi/*.f))
|
||||
eig_mi_obj:=$(patsubst %.f,%.o, $(eig_mi_src))
|
||||
|
||||
eig_pw_src:=$(filter-out eig/pw/main.f, $(wildcard eig/pw/*.f))
|
||||
eig_pw_obj:=$(patsubst %.f,%.o, $(eig_pw_src))
|
||||
|
||||
ifeq ($(USE_MKL), 1)
|
||||
eig_common_src:=$(filter-out $(wildcard eig/common/lapack*.f), $(eig_common_src))
|
||||
phd_mi_noso_nosp_nosym_src:=$(filter-out $(wildcard phd_mi_noso_nosp_nosym/lapack*.f), $(phd_mi_noso_nosp_nosym))
|
||||
LINKER_FLAGS:=$(shell pkg-config --libs lapack)
|
||||
# MKL:=-L$(MKLROOT) -lmkl_core -lmkl_intel_lp64 -lmkl_sequential
|
||||
endif
|
||||
|
||||
objects_src := $(memalloc_src) $(cluster_gen_src) $(common_sub_src)
|
||||
objects_src += $(renormalization_src) $(phd_se_noso_nosp_nosym_src)
|
||||
objects_src += $(eig_common_src) $(eig_mi_src) $(eig_pw_src)
|
||||
objects_src += $(phd_mi_noso_nosp_nosym_src)
|
||||
|
||||
memalloc_obj:=$(patsubst %.f,%.o, $(memalloc_src))
|
||||
cluster_gen_obj:=$(patsubst %.f,%.o, $(cluster_gen_src))
|
||||
common_sub_obj:=$(patsubst %.f,%.o, $(common_sub_src))
|
||||
renormalization_obj:=$(patsubst %.f,%.o, $(renormalization_src))
|
||||
phd_se_noso_nosp_nosym_obj:=$(patsubst %.f,%.o, $(phd_se_noso_nosp_nosym_src))
|
||||
phd_mi_noso_nosp_nosym_obj:=$(patsubst %.f,%.o, $(phd_mi_noso_nosp_nosym_src))
|
||||
eig_common_obj:=$(patsubst %.f,%.o, $(eig_common_src))
|
||||
eig_mi_obj:=$(patsubst %.f,%.o, $(eig_mi_src))
|
||||
eig_pw_obj:=$(patsubst %.f,%.o, $(eig_pw_src))
|
||||
objects:=$(patsubst %.f,%.o, $(objects_src))
|
||||
|
||||
libs_targets := phd_se_noso_nosp_nosym.target phd_mi_noso_nosp_nosym.target eig_mi.target eig_pw.target
|
||||
|
@ -58,6 +64,8 @@ export COMP_OPTS
|
|||
|
||||
.PHONY: clean
|
||||
|
||||
truc:
|
||||
@echo $(eig_common_src)
|
||||
|
||||
pybinding: $(libs_targets)
|
||||
|
||||
|
@ -68,17 +76,17 @@ phd_se_noso_nosp_nosym.target: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_o
|
|||
|
||||
phd_mi_noso_nosp_nosym.target: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_obj) $(renormalization_obj) $(phd_mi_noso_nosp_nosym_obj)
|
||||
@echo "building Python binding..."
|
||||
@$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $(patsubst %.target, %, $@) phd_mi_noso_nosp_nosym/main.f
|
||||
@$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $(patsubst %.target, %, $@) phd_mi_noso_nosp_nosym/main.f $(LINKER_FLAGS)
|
||||
@touch $@
|
||||
|
||||
eig_mi.target: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_obj) $(renormalization_obj) $(eig_common_obj) $(eig_mi_obj)
|
||||
@echo "building Python binding..."
|
||||
@$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $(patsubst %.target, %, $@) eig/mi/main.f
|
||||
@$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $(patsubst %.target, %, $@) eig/mi/main.f $(LINKER_FLAGS)
|
||||
@touch $@
|
||||
|
||||
eig_pw.target: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_obj) $(renormalization_obj) $(eig_common_obj) $(eig_pw_obj)
|
||||
@echo "building Python binding..."
|
||||
@$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $(patsubst %.target, %, $@) eig/pw/main.f
|
||||
@$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $(patsubst %.target, %, $@) eig/pw/main.f $(LINKER_FLAGS)
|
||||
@touch $@
|
||||
|
||||
%.o: %.f
|
||||
|
|
Loading…
Reference in New Issue