2021-04-01 13:49:53 +02:00
|
|
|
## Compilers, compiler flags & external libs
|
|
|
|
ifeq ($(ENV),INTEL)
|
|
|
|
CXX = icpc
|
|
|
|
FC = ifort
|
|
|
|
ARCH = -xCORE-AVX2
|
|
|
|
OPT = -O0
|
|
|
|
DEBUG = -debug full
|
|
|
|
else ifeq ($(ENV),LLVM)
|
|
|
|
CXX = clang++
|
|
|
|
FC = flang
|
|
|
|
ARCH =
|
|
|
|
OPT = -O0
|
|
|
|
DEBUG = -g
|
|
|
|
else ifeq ($(ENV),GNU)
|
|
|
|
CXX = g++
|
|
|
|
FC = gfortran
|
|
|
|
ARCH = -mavx
|
|
|
|
OPT = -O0
|
|
|
|
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-04-15 18:13:26 +02:00
|
|
|
CXXFLAGS = $(OPT) $(ARCH) $(DEBUG) -fPIC $(THRESHOLD)
|
2021-03-12 12:38:50 +01:00
|
|
|
FFLAGS = $(CXXFLAGS)
|
2021-04-01 13:49:53 +02:00
|
|
|
H5CXX = h5c++
|
2021-04-15 12:17:12 +02:00
|
|
|
H5CXXFLAGS = $(CXXFLAGS)
|
2021-03-12 12:38:50 +01:00
|
|
|
FLIBS = -lstdc++
|
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 \
|
|
|
|
$(OBJ_DIR)/SM_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-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-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)
|
|
|
|
$(H5CXX) $(H5CXXFLAGS) $(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)
|
|
|
|
$(CXX) -o $@ $^
|
|
|
|
|
2021-04-06 16:17:42 +02:00
|
|
|
$(BIN_DIR)/test_h5: $(OBJ_DIR)/test_h5.o $(DEPS_CXX) | $(BIN_DIR)
|
2021-02-28 09:28:42 +01:00
|
|
|
$(H5CXX) -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)
|
|
|
|
$(FC) $(FLIBS) -o $@ $^
|
|
|
|
|
|
|
|
$(BIN_DIR)/fMaponiA3_test_4x4_2: $(DEPS_F) $(OBJ_DIR)/fMaponiA3_test_4x4_2.o | $(BIN_DIR)
|
|
|
|
$(FC) $(FLIBS) -o $@ $^
|
|
|
|
|
|
|
|
$(BIN_DIR)/QMCChem_dataset_test: $(DEPS_F) $(OBJ_DIR)/QMCChem_dataset_test.o | $(BIN_DIR)
|
|
|
|
$(FC) $(FLIBS) -o $@ $^
|