2021-04-01 13:49:53 +02:00
|
|
|
## Compilers, compiler flags & external libs
|
|
|
|
ifeq ($(ENV),INTEL)
|
2021-07-21 16:32:13 +02:00
|
|
|
CXX = icpx
|
2021-04-01 13:49:53 +02:00
|
|
|
FC = ifort
|
2021-07-29 12:01:26 +02:00
|
|
|
ARCH = -xCORE-AVX2
|
2021-07-09 14:30:29 +02:00
|
|
|
OPT = -O3
|
2021-06-23 17:28:29 +02:00
|
|
|
DEBUG = -g -debug full
|
2021-04-01 13:49:53 +02:00
|
|
|
else ifeq ($(ENV),LLVM)
|
|
|
|
CXX = clang++
|
|
|
|
FC = flang
|
2021-07-09 14:30:29 +02:00
|
|
|
ARCH = -march=native
|
|
|
|
OPT = -O3
|
2021-04-01 13:49:53 +02:00
|
|
|
DEBUG = -g
|
|
|
|
else ifeq ($(ENV),GNU)
|
|
|
|
CXX = g++
|
|
|
|
FC = gfortran
|
2021-07-29 12:01:26 +02:00
|
|
|
# ARCH = -mavx
|
|
|
|
ARCH =
|
|
|
|
OPT = -O1
|
2021-04-01 13:49:53 +02:00
|
|
|
DEBUG = -g
|
|
|
|
else
|
2021-04-15 12:17:12 +02:00
|
|
|
$(error No valid compiler environment set in $$ENV. \
|
|
|
|
First run: $$ source smvars.sh {intel | llvm | gnu})
|
2021-04-01 13:49:53 +02:00
|
|
|
endif
|
2021-07-09 16:54:37 +02:00
|
|
|
HDF5_CXX = $(CXX)
|
2021-05-21 16:19:08 +02:00
|
|
|
H5CXX = h5c++
|
|
|
|
FLIBS = -lstdc++
|
2021-05-20 19:21:59 +02:00
|
|
|
CXXFLAGS = $(OPT) $(ARCH) $(DEBUG) $(THRESHOLD) -fPIC
|
2021-05-21 16:19:08 +02:00
|
|
|
|
|
|
|
## MKL linker flags
|
2021-05-21 11:54:57 +02:00
|
|
|
ifeq ($(MKL),-DMKL)
|
2021-05-21 16:19:08 +02:00
|
|
|
CXXFLAGS += $(MKL)
|
2021-07-20 16:58:04 +02:00
|
|
|
H5LFLAGS = -L$(MKLROOT)/lib/intel64 -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl
|
2021-05-21 16:19:08 +02:00
|
|
|
ifeq ($(ENV),INTEL)
|
|
|
|
LFLAGS = -mkl=sequential # implicit
|
|
|
|
else
|
|
|
|
LFLAGS = $(H5LFLAGS)
|
|
|
|
endif
|
2021-05-21 11:54:57 +02:00
|
|
|
endif
|
2021-04-15 12:17:12 +02:00
|
|
|
H5CXXFLAGS = $(CXXFLAGS)
|
2021-05-21 16:19:08 +02:00
|
|
|
FFLAGS = $(CXXFLAGS)
|
The algorithm now works for the following 4x4 example with 2 updates:
S = [1,0,1,-1; 0,1,1,0; -1,0,-1,0; 1,1,1,1]
S_inv = [1,-1,1,1; 1,0,2,1; -1,1,-2,-1; -1,0,-1,0]
u1 = [0,-2,0,0]
u2 = [0,-1,0,0]
upd_idx = [2,4]
To go from Maponi's examples where the number of updates is always equal
to the the dimension of the matrix, and the decomposition is always
diagonal, to cases with a non-diagonal decomposition and a number of
updates unequal to its size, the following changed needed to be made:
* in the calculation of the {y0k} an extra inner for-loop needs to be
added to make it a full matrix-vector multiplication due to the fact
that A0 is not a diagonal matrix
* in some places the use of the update-order vector p needs
the be replaced with that of upd_idx to make sure the correct
component of the ylk is selected and the proper rank-1 matrices are
constructed
* when a matrix is passed from Fortran to C++ with 2D adressing, it is
passed in colum-major order. The passed matrix needs to be transposed
before passing to C++. Doing this inside the algorithm will break
compatibility with called from C/C++.
2021-02-21 18:28:08 +01:00
|
|
|
|
2021-04-01 13:49:53 +02:00
|
|
|
## Includes and dependencies
|
2021-02-27 12:25:55 +01:00
|
|
|
INCLUDE = -I $(INC_DIR)/
|
2021-05-07 17:11:04 +02:00
|
|
|
DEPS_CXX = $(OBJ_DIR)/SM_Maponi.o \
|
2021-04-14 17:18:31 +02:00
|
|
|
$(OBJ_DIR)/SM_Standard.o \
|
2021-06-04 16:50:49 +02:00
|
|
|
$(OBJ_DIR)/Woodbury.o \
|
|
|
|
$(OBJ_DIR)/SMWB.o \
|
|
|
|
$(OBJ_DIR)/Helpers.o
|
2021-04-15 12:17:12 +02:00
|
|
|
DEPS_F = $(DEPS_CXX) \
|
2021-05-07 17:11:04 +02:00
|
|
|
$(OBJ_DIR)/finterface_mod.o \
|
|
|
|
$(OBJ_DIR)/helpers_mod.o
|
The algorithm now works for the following 4x4 example with 2 updates:
S = [1,0,1,-1; 0,1,1,0; -1,0,-1,0; 1,1,1,1]
S_inv = [1,-1,1,1; 1,0,2,1; -1,1,-2,-1; -1,0,-1,0]
u1 = [0,-2,0,0]
u2 = [0,-1,0,0]
upd_idx = [2,4]
To go from Maponi's examples where the number of updates is always equal
to the the dimension of the matrix, and the decomposition is always
diagonal, to cases with a non-diagonal decomposition and a number of
updates unequal to its size, the following changed needed to be made:
* in the calculation of the {y0k} an extra inner for-loop needs to be
added to make it a full matrix-vector multiplication due to the fact
that A0 is not a diagonal matrix
* in some places the use of the update-order vector p needs
the be replaced with that of upd_idx to make sure the correct
component of the ylk is selected and the proper rank-1 matrices are
constructed
* when a matrix is passed from Fortran to C++ with 2D adressing, it is
passed in colum-major order. The passed matrix needs to be transposed
before passing to C++. Doing this inside the algorithm will break
compatibility with called from C/C++.
2021-02-21 18:28:08 +01:00
|
|
|
|
2021-07-20 16:58:04 +02:00
|
|
|
## QMCkl includes and linking
|
2021-07-21 11:48:32 +02:00
|
|
|
QMCKL_INCLUDE = -I $(SMROOT)/qmckl/build/include
|
2021-07-20 16:58:04 +02:00
|
|
|
QMCKLLFLAGS = -L$(SMROOT)/qmckl/build/lib -lqmckl
|
|
|
|
|
|
|
|
|
2021-04-01 13:49:53 +02:00
|
|
|
## Directory structure
|
2021-02-27 12:25:55 +01:00
|
|
|
SRC_DIR := src
|
|
|
|
TST_DIR := tests
|
|
|
|
INC_DIR := include
|
|
|
|
OBJ_DIR := build
|
|
|
|
BIN_DIR := bin
|
The algorithm now works for the following 4x4 example with 2 updates:
S = [1,0,1,-1; 0,1,1,0; -1,0,-1,0; 1,1,1,1]
S_inv = [1,-1,1,1; 1,0,2,1; -1,1,-2,-1; -1,0,-1,0]
u1 = [0,-2,0,0]
u2 = [0,-1,0,0]
upd_idx = [2,4]
To go from Maponi's examples where the number of updates is always equal
to the the dimension of the matrix, and the decomposition is always
diagonal, to cases with a non-diagonal decomposition and a number of
updates unequal to its size, the following changed needed to be made:
* in the calculation of the {y0k} an extra inner for-loop needs to be
added to make it a full matrix-vector multiplication due to the fact
that A0 is not a diagonal matrix
* in some places the use of the update-order vector p needs
the be replaced with that of upd_idx to make sure the correct
component of the ylk is selected and the proper rank-1 matrices are
constructed
* when a matrix is passed from Fortran to C++ with 2D adressing, it is
passed in colum-major order. The passed matrix needs to be transposed
before passing to C++. Doing this inside the algorithm will break
compatibility with called from C/C++.
2021-02-21 18:28:08 +01:00
|
|
|
|
2021-02-27 12:25:55 +01:00
|
|
|
EXEC := $(BIN_DIR)/cMaponiA3_test_3x3_3 \
|
2021-04-06 16:17:42 +02:00
|
|
|
$(BIN_DIR)/test_h5 \
|
2021-07-09 14:30:29 +02:00
|
|
|
$(BIN_DIR)/fnu_test_h5 \
|
2021-02-27 12:25:55 +01:00
|
|
|
$(BIN_DIR)/fMaponiA3_test_3x3_3 \
|
|
|
|
$(BIN_DIR)/fMaponiA3_test_4x4_2 \
|
|
|
|
$(BIN_DIR)/QMCChem_dataset_test
|
The algorithm now works for the following 4x4 example with 2 updates:
S = [1,0,1,-1; 0,1,1,0; -1,0,-1,0; 1,1,1,1]
S_inv = [1,-1,1,1; 1,0,2,1; -1,1,-2,-1; -1,0,-1,0]
u1 = [0,-2,0,0]
u2 = [0,-1,0,0]
upd_idx = [2,4]
To go from Maponi's examples where the number of updates is always equal
to the the dimension of the matrix, and the decomposition is always
diagonal, to cases with a non-diagonal decomposition and a number of
updates unequal to its size, the following changed needed to be made:
* in the calculation of the {y0k} an extra inner for-loop needs to be
added to make it a full matrix-vector multiplication due to the fact
that A0 is not a diagonal matrix
* in some places the use of the update-order vector p needs
the be replaced with that of upd_idx to make sure the correct
component of the ylk is selected and the proper rank-1 matrices are
constructed
* when a matrix is passed from Fortran to C++ with 2D adressing, it is
passed in colum-major order. The passed matrix needs to be transposed
before passing to C++. Doing this inside the algorithm will break
compatibility with called from C/C++.
2021-02-21 18:28:08 +01:00
|
|
|
|
2021-02-04 18:52:26 +01:00
|
|
|
## Build tagets
|
2021-02-04 13:12:34 +01:00
|
|
|
.PHONY: all clean distclean
|
|
|
|
|
2021-02-27 12:25:55 +01:00
|
|
|
all: $(EXEC)
|
|
|
|
|
2021-02-04 13:12:34 +01:00
|
|
|
clean:
|
2021-04-09 17:21:31 +02:00
|
|
|
@rm -vrf $(OBJ_DIR) *.dbg *.cmdx *.cmod *.ilm *.stb
|
2021-02-09 13:40:52 +01:00
|
|
|
|
2021-02-04 13:12:34 +01:00
|
|
|
distclean: clean
|
2021-02-26 17:28:52 +01:00
|
|
|
@rm -vrf $(BIN_DIR) \
|
|
|
|
Slater* Updates.dat
|
The algorithm now works for the following 4x4 example with 2 updates:
S = [1,0,1,-1; 0,1,1,0; -1,0,-1,0; 1,1,1,1]
S_inv = [1,-1,1,1; 1,0,2,1; -1,1,-2,-1; -1,0,-1,0]
u1 = [0,-2,0,0]
u2 = [0,-1,0,0]
upd_idx = [2,4]
To go from Maponi's examples where the number of updates is always equal
to the the dimension of the matrix, and the decomposition is always
diagonal, to cases with a non-diagonal decomposition and a number of
updates unequal to its size, the following changed needed to be made:
* in the calculation of the {y0k} an extra inner for-loop needs to be
added to make it a full matrix-vector multiplication due to the fact
that A0 is not a diagonal matrix
* in some places the use of the update-order vector p needs
the be replaced with that of upd_idx to make sure the correct
component of the ylk is selected and the proper rank-1 matrices are
constructed
* when a matrix is passed from Fortran to C++ with 2D adressing, it is
passed in colum-major order. The passed matrix needs to be transposed
before passing to C++. Doing this inside the algorithm will break
compatibility with called from C/C++.
2021-02-21 18:28:08 +01:00
|
|
|
|
2021-02-04 13:12:34 +01:00
|
|
|
|
2021-02-27 12:25:55 +01:00
|
|
|
#### COMPILING
|
|
|
|
$(BIN_DIR) $(OBJ_DIR):
|
|
|
|
mkdir -p $@
|
2021-02-04 11:39:00 +01:00
|
|
|
|
2021-02-27 12:25:55 +01:00
|
|
|
### IMPLICIT BUILD RULES
|
|
|
|
## C++ objects
|
|
|
|
$(OBJ_DIR)/%.o: $(TST_DIR)/%.cpp $(INC_DIR)/* | $(OBJ_DIR)
|
2021-04-01 13:49:53 +02:00
|
|
|
$(CXX) $(CXXFLAGS) $(INCLUDE) -c -o $@ $<
|
2021-02-12 12:04:21 +01:00
|
|
|
|
2021-04-14 16:19:49 +02:00
|
|
|
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(INC_DIR)/* | $(OBJ_DIR)
|
2021-04-15 12:17:12 +02:00
|
|
|
$(CXX) $(CXXFLAGS) $(INCLUDE) -c -o $@ $<
|
2021-04-14 16:19:49 +02:00
|
|
|
|
2021-02-27 12:25:55 +01:00
|
|
|
## HDF5/C++ objects
|
|
|
|
$(OBJ_DIR)/%_h5.o: $(TST_DIR)/%_h5.cpp $(INC_DIR)/* | $(OBJ_DIR)
|
2021-07-20 16:58:04 +02:00
|
|
|
$(H5CXX) $(H5CXXFLAGS) $(INCLUDE) $(QMCKL_INCLUDE) -c -o $@ $<
|
2021-02-16 10:49:15 +01:00
|
|
|
|
2021-02-27 12:25:55 +01:00
|
|
|
## Fortran modules
|
|
|
|
$(OBJ_DIR)/%_mod.o: $(SRC_DIR)/%_mod.f90 | $(OBJ_DIR)
|
2021-04-01 13:49:53 +02:00
|
|
|
ifeq ($(ENV),$(filter $(ENV),LLVM GNU))
|
|
|
|
$(FC) $(FFLAGS) -J $(OBJ_DIR)/ -c -o $@ $<
|
|
|
|
else
|
|
|
|
$(FC) $(FFLAGS) -module $(OBJ_DIR)/ -c -o $@ $<
|
|
|
|
endif
|
2021-02-22 10:51:07 +01:00
|
|
|
|
2021-02-27 12:25:55 +01:00
|
|
|
## Fortran objects
|
|
|
|
$(OBJ_DIR)/%.o: $(TST_DIR)/%.f90 | $(OBJ_DIR)
|
2021-04-01 13:49:53 +02:00
|
|
|
$(FC) $(FFLAGS) -I $(OBJ_DIR)/ -c -o $@ $<
|
2021-02-26 17:28:52 +01:00
|
|
|
|
2021-02-27 12:25:55 +01:00
|
|
|
|
|
|
|
#### LINKING
|
|
|
|
$(BIN_DIR)/cMaponiA3_test_3x3_3: $(OBJ_DIR)/cMaponiA3_test_3x3_3.o $(DEPS_CXX) | $(BIN_DIR)
|
2021-05-20 19:21:59 +02:00
|
|
|
$(CXX) $(LFLAGS) -o $@ $^
|
2021-02-27 12:25:55 +01:00
|
|
|
|
2021-04-06 16:17:42 +02:00
|
|
|
$(BIN_DIR)/test_h5: $(OBJ_DIR)/test_h5.o $(DEPS_CXX) | $(BIN_DIR)
|
2021-05-20 19:21:59 +02:00
|
|
|
$(H5CXX) $(H5LFLAGS) -o $@ $^
|
2021-02-27 12:25:55 +01:00
|
|
|
|
2021-07-09 14:30:29 +02:00
|
|
|
$(BIN_DIR)/fnu_test_h5: $(OBJ_DIR)/fnu_test_h5.o $(DEPS_CXX) | $(BIN_DIR)
|
|
|
|
$(H5CXX) $(H5LFLAGS) -o $@ $^
|
|
|
|
|
2021-07-20 16:58:04 +02:00
|
|
|
$(BIN_DIR)/qmckl_test_h5: $(OBJ_DIR)/qmckl_test_h5.o | $(BIN_DIR)
|
|
|
|
$(H5CXX) $(H5LFLAGS) $(QMCKLLFLAGS) -o $@ $^
|
|
|
|
|
2021-02-27 12:25:55 +01:00
|
|
|
$(BIN_DIR)/fMaponiA3_test_3x3_3: $(DEPS_F) $(OBJ_DIR)/fMaponiA3_test_3x3_3.o | $(BIN_DIR)
|
2021-05-20 19:21:59 +02:00
|
|
|
$(FC) $(LFLAGS) $(FLIBS) -o $@ $^
|
2021-02-27 12:25:55 +01:00
|
|
|
|
|
|
|
$(BIN_DIR)/fMaponiA3_test_4x4_2: $(DEPS_F) $(OBJ_DIR)/fMaponiA3_test_4x4_2.o | $(BIN_DIR)
|
2021-05-20 19:21:59 +02:00
|
|
|
$(FC) $(LFLAGS) $(FLIBS) -o $@ $^
|
2021-02-27 12:25:55 +01:00
|
|
|
|
|
|
|
$(BIN_DIR)/QMCChem_dataset_test: $(DEPS_F) $(OBJ_DIR)/QMCChem_dataset_test.o | $(BIN_DIR)
|
2021-05-20 19:21:59 +02:00
|
|
|
$(FC) $(LFLAGS) $(FLIBS) -o $@ $^
|