Merge pull request #23 from fmgjcoppens/cleanup

Cleanup
This commit is contained in:
François Coppens 2021-04-06 16:59:35 +02:00 committed by GitHub
commit 8649574933
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 25019 additions and 63 deletions

3
.gitignore vendored
View File

@ -1,7 +1,8 @@
*.o
*.mod
*.dbg
.vscode
Slater*
Updates*
datasets/datasets.*
datasets/dataset.*
bin/

View File

@ -1,19 +1,37 @@
## Compilers
## 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 =
CXX = clang++-7
FC = flang-7
H5CXX = h5c++
## Compiler flags
CXXFLAGS = -O0
OPT = -O0
DEBUG = -g
else ifeq ($(ENV),GNU)
CXX = g++
FC = gfortran
ARCH = -mavx
OPT = -O0
DEBUG = -g
else
$(error No valid compiler environment set in $$ENV. First run: $$ source smvars.sh {intel | llvm | gnu})
endif
CXXFLAGS = $(OPT) $(ARCH) $(DEBUG)
FFLAGS = $(CXXFLAGS)
H5CXX = h5c++
H5CXXFLAGS = $(CXXFLAGS) -fPIC
FLIBS = -lstdc++
## Includes and dependencies
INCLUDE = -I $(INC_DIR)/
DEPS_CXX = $(OBJ_DIR)/SM_MaponiA3.o $(OBJ_DIR)/SM_Standard.o
DEPS_F = $(DEPS_CXX) $(OBJ_DIR)/SM_MaponiA3_mod.o $(OBJ_DIR)/Helpers_mod.o
## Directory structure
SRC_DIR := src
TST_DIR := tests
INC_DIR := include
@ -21,7 +39,7 @@ OBJ_DIR := build
BIN_DIR := bin
EXEC := $(BIN_DIR)/cMaponiA3_test_3x3_3 \
$(BIN_DIR)/test_internal_h5 \
$(BIN_DIR)/test_h5 \
$(BIN_DIR)/fMaponiA3_test_3x3_3 \
$(BIN_DIR)/fMaponiA3_test_4x4_2 \
$(BIN_DIR)/QMCChem_dataset_test
@ -32,7 +50,7 @@ EXEC := $(BIN_DIR)/cMaponiA3_test_3x3_3 \
all: $(EXEC)
clean:
@rm -vrf $(OBJ_DIR)
@rm -vrf $(OBJ_DIR) *.dbg
distclean: clean
@rm -vrf $(BIN_DIR) \
@ -46,7 +64,7 @@ $(BIN_DIR) $(OBJ_DIR):
### IMPLICIT BUILD RULES
## C++ objects
$(OBJ_DIR)/%.o: $(TST_DIR)/%.cpp $(INC_DIR)/* | $(OBJ_DIR)
$(CXX) $(CXXFLAGS) $(ARCH) $(INCLUDE) -c -o $@ $<
$(CXX) $(CXXFLAGS) $(INCLUDE) -c -o $@ $<
## HDF5/C++ objects
$(OBJ_DIR)/%_h5.o: $(TST_DIR)/%_h5.cpp $(INC_DIR)/* | $(OBJ_DIR)
@ -54,26 +72,30 @@ $(OBJ_DIR)/%_h5.o: $(TST_DIR)/%_h5.cpp $(INC_DIR)/* | $(OBJ_DIR)
## Fortran modules
$(OBJ_DIR)/%_mod.o: $(SRC_DIR)/%_mod.f90 | $(OBJ_DIR)
$(FC) $(FFLAGS) $(ARCH) -J$(OBJ_DIR)/ -c -o $@ $<
ifeq ($(ENV),$(filter $(ENV),LLVM GNU))
$(FC) $(FFLAGS) -J $(OBJ_DIR)/ -c -o $@ $<
else
$(FC) $(FFLAGS) -module $(OBJ_DIR)/ -c -o $@ $<
endif
## Fortran objects
$(OBJ_DIR)/%.o: $(TST_DIR)/%.f90 | $(OBJ_DIR)
$(FC) $(FFLAGS) $(ARCH) -I $(OBJ_DIR)/ -c -o $@ $<
$(FC) $(FFLAGS) -I $(OBJ_DIR)/ -c -o $@ $<
### EXPLICIT BUILD RULES
## special compiler flag -fPIC otherwise h5c++ builds fail
$(OBJ_DIR)/SM_MaponiA3.o: $(SRC_DIR)/SM_MaponiA3.cpp $(INC_DIR)/* | $(OBJ_DIR)
$(CXX) $(CXXFLAGS) -fPIC $(ARCH) $(INCLUDE) -c -o $@ $<
$(CXX) $(CXXFLAGS) -fPIC $(INCLUDE) -c -o $@ $<
$(OBJ_DIR)/SM_Standard.o: $(SRC_DIR)/SM_Standard.cpp $(INC_DIR)/* | $(OBJ_DIR)
$(CXX) $(CXXFLAGS) -fPIC $(ARCH) $(INCLUDE) -c -o $@ $<
$(CXX) $(CXXFLAGS) -fPIC $(INCLUDE) -c -o $@ $<
#### LINKING
$(BIN_DIR)/cMaponiA3_test_3x3_3: $(OBJ_DIR)/cMaponiA3_test_3x3_3.o $(DEPS_CXX) | $(BIN_DIR)
$(CXX) -o $@ $^
$(BIN_DIR)/test_internal_h5: $(OBJ_DIR)/test_internal_h5.o $(DEPS_CXX) | $(BIN_DIR)
$(BIN_DIR)/test_h5: $(OBJ_DIR)/test_h5.o $(DEPS_CXX) | $(BIN_DIR)
$(H5CXX) -o $@ $^
$(BIN_DIR)/fMaponiA3_test_3x3_3: $(DEPS_F) $(OBJ_DIR)/fMaponiA3_test_3x3_3.o | $(BIN_DIR)

View File

@ -1,20 +1,10 @@
## Compilers
#ARCH = -xCORE-AVX2
H5CXX = h5c++
#CXX = icpc
#FC = ifort
#CXX = ~/intel/compilers_and_libraries_2020.3.275/linux/bin/icpx
#FC = ~/intel/compilers_and_libraries_2020.3.275/linux/bin/intel64/ifort
H5FLAGS = "-I/usr/include/hdf5/serial -L/usr/lib/x86_64-linux-gnu/hdf5/serial /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_hl_cpp.a /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.a /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_hl.a /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.a -lpthread -lsz -lz -ldl -lm -Wl,-rpath -Wl,/usr/lib/x86_64-linux-gnu/hdf5/serial"
CXX = verificarlo-c++
FC = verificarlo-f
## Compiler flags
#H5CXXFLAGS = -O0 -g
H5FLAGS = "-I/usr/include/hdf5/serial -L/usr/lib/x86_64-linux-gnu/hdf5/serial /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_hl_cpp.a /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.a /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_hl.a /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.a -lpthread -lsz -lz -ldl -lm -Wl,-rpath -Wl,/usr/lib/x86_64-linux-gnu/hdf5/serial"
CXXFLAGS = -O0 -g $(H5FLAGS)
FFLAGS = -O0 -g $(H5FLAGS)
@ -30,7 +20,7 @@ OBJ_DIR := build
BIN_DIR := bin
EXEC := $(BIN_DIR)/cMaponiA3_test_3x3_3 \
$(BIN_DIR)/test_internal_h5 \
$(BIN_DIR)/test_h5 \
$(BIN_DIR)/fMaponiA3_test_3x3_3 \
$(BIN_DIR)/fMaponiA3_test_4x4_2 \
$(BIN_DIR)/QMCChem_dataset_test
@ -85,7 +75,7 @@ $(BIN_DIR)/cMaponiA3_test_3x3_3: $(OBJ_DIR)/cMaponiA3_test_3x3_3.o $(DEPS_CXX) |
$(CXX) -o $@ $^
#begin H5
$(BIN_DIR)/test_internal_h5: $(OBJ_DIR)/test_internal_h5.o $(DEPS_CXX) | $(BIN_DIR)
$(BIN_DIR)/test_h5: $(OBJ_DIR)/test_h5.o $(DEPS_CXX) | $(BIN_DIR)
$(CXX) -o $@ $^ $(H5FLAGS)
#$(BIN_DIR)/test_external_h5: $(OBJ_DIR)/test_external_h5.o $(DEPS_CXX) | $(BIN_DIR)
# $(CXX) -o $@ $^ $(H5FLAGS)

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
start_cycle=$1
stop_cycle=$2
if [ "$#" -ne 2 ]
then
echo "usage: ./run-tests.sh <start cycle> <stop cycle>"
exit 1
fi
if [ ! -f "bin/test_external_h5" ]
then
make bin/test_external_h5
fi
cd datasets/
for ((cycle = start_cycle; cycle < stop_cycle+1; cycle++))
do
../bin/test_external_h5 $cycle
done

47
smvars.sh Normal file
View File

@ -0,0 +1,47 @@
#!/usr/bin/env bash
ENV=$1
PWD=$(pwd)
SRCDIR=$(dirname $BASH_SOURCE)
case $SRCDIR in
/*) SMROOT=$SRCDIR ;; ## sourced from absolute path
*) ## sourced from absolute path
if [[ $SRCDIR = . ]] ## check if already in root
then
SMROOT=$PWD
else
SMROOT=$PWD/$SRCDIR
fi
;;
esac
export SMROOT
case $ENV in
intel)
export HDF5_CXX=icpc
export HDF5_CXXLINKER=icpc
export ENV=INTEL
;;
llvm)
export HDF5_CXX=clang++
export HDF5_CXXLINKER=clang++
export ENV=LLVM
;;
gnu)
export HDF5_CXX=g++
export HDF5_CXXLINKER=g++
export ENV=GNU
;;
*)
echo "Unknown environment descriptor given."
echo "Usage: source smvars.sh {intel | llvm | gnu}"
return 1
;;
esac
if [[ -z $SMVARS ]]
then
export PATH=$SMROOT/bin:$PATH
export SMVARS=true
fi

View File

@ -1,6 +0,0 @@
#!/usr/bin/env bash
export HDF5_CXX=icpc
export HDF5_CXXLINKER=icpc
export PATH=$PWD/bin:$PATH

View File

@ -27,7 +27,7 @@ void SM1(double *Slater_inv, unsigned int Dim, unsigned int N_updates,
// Denominator
double den = 1 + C[Updates_index[l] - 1];
if (fabs(den) < 1e-6) {
std::cerr << "Breakdown condition triggered at " << l << std::endl;
std::cerr << "Breakdown condition triggered at " << Updates_index[l] << std::endl;
}
double iden = 1 / den;
@ -75,7 +75,7 @@ void SM2(double *Slater_inv, unsigned int Dim, unsigned int N_updates,
// Denominator
double den = 1 + C[Updates_index[l] - 1];
if (fabs(den) < 1e-6) {
std::cerr << "Breakdown condition triggered at " << l << std::endl;
std::cerr << "Breakdown condition triggered at " << Updates_index[l] << std::endl;
// U_l = U_l / 2 (do the split)
for (unsigned int j = 0; j < Dim; j++) {
@ -135,7 +135,7 @@ void SM3(double *Slater_inv, unsigned int Dim, unsigned int N_updates,
// Denominator
double den = 1 + C[Updates_index[l] - 1];
if (fabs(den) < 1e-6) {
std::cerr << "Breakdown condition triggered at " << l << std::endl;
std::cerr << "Breakdown condition triggered at " << Updates_index[l] << std::endl;
for (unsigned int j = 0; j < Dim; j++) {
later_updates[later*Dim+j] = Updates[l*Dim+j];

View File

@ -9,7 +9,7 @@ program QMCChem_dataset_test
real(c_double), dimension(:,:), allocatable :: Updates, U
real(c_double), dimension(:,:), allocatable :: S, S_inv, S_inv_t
call Read_dataset("datasets/update_cycle_8169_repl.dat", &
call Read_dataset("update_cycle_13.dat", &
cycle_id, &
dim, &
n_updates, &

View File

@ -130,7 +130,7 @@ int test_cycle(H5File file, int cycle, std::string version) {
int main(int argc, char **argv) {
if (argc != 4) {
std::cerr << "Execute from within 'datasets/'" << std::endl;
std::cerr << "usage: test_internal_h5 <version> <start cycle> <stop cycle>" << std::endl;
std::cerr << "usage: test_h5 <version> <start cycle> <stop cycle>" << std::endl;
return 1;
}
std::string version(argv[1]);