Cleanup 1

This commit is contained in:
François Coppens 2021-07-15 17:56:33 +02:00
parent 08e4e56e50
commit 2a39aabaf0
7 changed files with 33 additions and 45 deletions

View File

@ -1,6 +1,6 @@
## Compilers, compiler flags & external libs ## Compilers, compiler flags & external libs
ifeq ($(ENV),INTEL) ifeq ($(ENV),INTEL)
CXX = icpc CXX = icpx
FC = ifort FC = ifort
ARCH = -march=native ARCH = -march=native
OPT = -O3 OPT = -O3
@ -15,7 +15,7 @@ else ifeq ($(ENV),GNU)
CXX = g++ CXX = g++
FC = gfortran FC = gfortran
ARCH = -mavx ARCH = -mavx
OPT = -O0 OPT = -O3
DEBUG = -g DEBUG = -g
else else
$(error No valid compiler environment set in $$ENV. \ $(error No valid compiler environment set in $$ENV. \

View File

@ -4,18 +4,8 @@ void SMWB1(double *Slater_inv, const unsigned int Dim,
const unsigned int N_updates, double *Updates, const unsigned int N_updates, double *Updates,
unsigned int *Updates_index); unsigned int *Updates_index);
// // Sherman-Morrison-Woodbury kernel 2 // Sherman-Morrison-Woodbury kernel 2
// // WB2, WB3, SM3 mixing scheme
// void SMWB2(double *Slater_inv, unsigned int Dim, unsigned int N_updates,
// double *Updates, unsigned int *Updates_index);
// // Sherman-Morrison-Woodbury kernel 3
// // WB2, WB3, SM4 mixing scheme
// void SMWB3(double *Slater_inv, unsigned int Dim, unsigned int N_updates,
// double *Updates, unsigned int *Updates_index);
// Sherman-Morrison-Woodbury kernel 4
// WB2, SM2 mixing scheme // WB2, SM2 mixing scheme
void SMWB4(double *Slater_inv, const unsigned int Dim, void SMWB2(double *Slater_inv, const unsigned int Dim,
const unsigned int N_updates, double *Updates, const unsigned int N_updates, double *Updates,
unsigned int *Updates_index); unsigned int *Updates_index);

View File

@ -27,20 +27,23 @@ export SMROOT
case $ENV in case $ENV in
intel) intel)
echo "* SM build environment set to 'intel'" echo "* SM build environment set to 'intel'"
export HDF5_CXX=icpc export HDF5_CXX=icpx
export HDF5_CXXLINKER=icpc export HDF5_CXXLINKER=icpx
export HDF5_CLINKER=icpx
export ENV=INTEL export ENV=INTEL
;; ;;
llvm) llvm)
echo "* SM build environment set to 'llvm'" echo "* SM build environment set to 'llvm'"
export HDF5_CXX=clang++ export HDF5_CXX=clang++
export HDF5_CXXLINKER=clang++ export HDF5_CXXLINKER=clang++
export HDF5_CLINKER=clang++
export ENV=LLVM export ENV=LLVM
;; ;;
vfc) vfc)
echo "* SM build environment set to 'vfc'" echo "* SM build environment set to 'vfc'"
export HDF5_CXX=clang++ export HDF5_CXX=clang++
export HDF5_CXXLINKER=clang++ export HDF5_CXXLINKER=clang++
export HDF5_CLINKER=clang++
export ENV=LLVM export ENV=LLVM
export VFC_BACKENDS="libinterflop_ieee.so --count-op" export VFC_BACKENDS="libinterflop_ieee.so --count-op"
;; ;;
@ -48,6 +51,7 @@ case $ENV in
echo "* SM build environment set to 'gnu'" echo "* SM build environment set to 'gnu'"
export HDF5_CXX=g++ export HDF5_CXX=g++
export HDF5_CXXLINKER=g++ export HDF5_CXXLINKER=g++
export HDF5_CLINKER=g++
export ENV=GNU export ENV=GNU
;; ;;
*) *)

View File

@ -80,9 +80,9 @@ void SMWB1(double *Slater_inv, const unsigned int Dim,
} }
} }
// Sherman-Morrison-Woodbury kernel 4 // Sherman-Morrison-Woodbury kernel 2
// WB2, SM2 mixing scheme // WB2, SM2 mixing scheme
void SMWB4(double *Slater_inv, const unsigned int Dim, void SMWB2(double *Slater_inv, const unsigned int Dim,
const unsigned int N_updates, double *Updates, const unsigned int N_updates, double *Updates,
unsigned int *Updates_index) { unsigned int *Updates_index) {
#ifdef DEBUG2 #ifdef DEBUG2
@ -144,8 +144,8 @@ void SMWB1_f(double **linSlater_inv, unsigned int *Dim, unsigned int *N_updates,
double **linUpdates, unsigned int **Updates_index) { double **linUpdates, unsigned int **Updates_index) {
SMWB1(*linSlater_inv, *Dim, *N_updates, *linUpdates, *Updates_index); SMWB1(*linSlater_inv, *Dim, *N_updates, *linUpdates, *Updates_index);
} }
void SMWB4_f(double **linSlater_inv, unsigned int *Dim, unsigned int *N_updates, void SMWB2_f(double **linSlater_inv, unsigned int *Dim, unsigned int *N_updates,
double **linUpdates, unsigned int **Updates_index) { double **linUpdates, unsigned int **Updates_index) {
SMWB4(*linSlater_inv, *Dim, *N_updates, *linUpdates, *Updates_index); SMWB2(*linSlater_inv, *Dim, *N_updates, *linUpdates, *Updates_index);
} }
} }

View File

@ -134,8 +134,8 @@ bool WB3(double *Slater_inv, const unsigned int Dim, double *Updates,
// Check if determinant of B is not too close to zero // Check if determinant of B is not too close to zero
double det; double det;
det = B0 * (B4 * B8 - B5 * B7) - det = B0 * (B4 * B8 - B5 * B7) - B1 * (B3 * B8 - B5 * B6) +
B1 * (B3 * B8 - B5 * B6) + B2 * (B3 * B7 - B4 * B6); B2 * (B3 * B7 - B4 * B6);
#ifdef DEBUG2 #ifdef DEBUG2
std::cerr << "Determinant of B = " << det << std::endl; std::cerr << "Determinant of B = " << det << std::endl;
#endif #endif
@ -198,10 +198,14 @@ bool WB3(double *Slater_inv, const unsigned int Dim, double *Updates,
extern "C" { extern "C" {
bool WB2_f(double **linSlater_inv, unsigned int *Dim, double **linUpdates, bool WB2_f(double **linSlater_inv, unsigned int *Dim, double **linUpdates,
unsigned int **Updates_index) { unsigned int **Updates_index) {
WB2(*linSlater_inv, *Dim, *linUpdates, *Updates_index); bool ok;
ok = WB2(*linSlater_inv, *Dim, *linUpdates, *Updates_index);
return ok;
} }
bool WB3_f(double **linSlater_inv, unsigned int *Dim, double **linUpdates, bool WB3_f(double **linSlater_inv, unsigned int *Dim, double **linUpdates,
unsigned int **Updates_index) { unsigned int **Updates_index) {
WB3(*linSlater_inv, *Dim, *linUpdates, *Updates_index); bool ok;
ok = WB3(*linSlater_inv, *Dim, *linUpdates, *Updates_index);
return ok;
} }
} }

View File

@ -126,11 +126,11 @@ int test_cycle(H5File file, int cycle, std::string version, double tolerance) {
dim * dim * sizeof(double)); dim * dim * sizeof(double));
SMWB1(slater_inverse_nonpersistent, dim, nupdates, u, col_update_index); SMWB1(slater_inverse_nonpersistent, dim, nupdates, u, col_update_index);
} }
} else if (version == "smwb4") { } else if (version == "smwb2") {
for (unsigned int i = 0; i < repetition_number; i++) { for (unsigned int i = 0; i < repetition_number; i++) {
std::memcpy(slater_inverse_nonpersistent, slater_inverse, std::memcpy(slater_inverse_nonpersistent, slater_inverse,
dim * dim * sizeof(double)); dim * dim * sizeof(double));
SMWB4(slater_inverse_nonpersistent, dim, nupdates, u, col_update_index); SMWB2(slater_inverse_nonpersistent, dim, nupdates, u, col_update_index);
} }
#ifdef MKL #ifdef MKL
} else if (version == "lapack") { } else if (version == "lapack") {
@ -170,8 +170,8 @@ int test_cycle(H5File file, int cycle, std::string version, double tolerance) {
// SMWB2(slater_inverse, dim, nupdates, u, col_update_index); // SMWB2(slater_inverse, dim, nupdates, u, col_update_index);
// } else if (version == "smwb3") { // } else if (version == "smwb3") {
// SMWB3(slater_inverse, dim, nupdates, u, col_update_index); // SMWB3(slater_inverse, dim, nupdates, u, col_update_index);
} else if (version == "smwb4") { } else if (version == "smwb2") {
SMWB4(slater_inverse, dim, nupdates, u, col_update_index); SMWB2(slater_inverse, dim, nupdates, u, col_update_index);
#ifdef MKL #ifdef MKL
} else if (version == "lapack") { } else if (version == "lapack") {
memcpy(slater_inverse, slater_matrix, dim * dim * sizeof(double)); memcpy(slater_inverse, slater_matrix, dim * dim * sizeof(double));

View File

@ -104,14 +104,8 @@ int test_cycle(H5File file, int cycle, std::string version, double tolerance) {
WB3(slater_inverse_nonpersistent, dim, u, col_update_index); WB3(slater_inverse_nonpersistent, dim, u, col_update_index);
} else if (version == "smwb1") { } else if (version == "smwb1") {
SMWB1(slater_inverse_nonpersistent, dim, nupdates, u, col_update_index); SMWB1(slater_inverse_nonpersistent, dim, nupdates, u, col_update_index);
// } else if (version == "smwb2") { } else if (version == "smwb2") {
// SMWB2(slater_inverse_nonpersistent, dim, nupdates, u, SMWB2(slater_inverse_nonpersistent, dim, nupdates, u, col_update_index);
// col_update_index);
// } else if (version == "smwb3") {
// SMWB3(slater_inverse_nonpersistent, dim, nupdates, u,
// col_update_index);
} else if (version == "smwb4") {
SMWB4(slater_inverse_nonpersistent, dim, nupdates, u, col_update_index);
#ifdef MKL #ifdef MKL
} else if (version == "lapack") { } else if (version == "lapack") {
memcpy(slater_inverse_nonpersistent, slater_matrix, memcpy(slater_inverse_nonpersistent, slater_matrix,
@ -145,10 +139,6 @@ int test_cycle(H5File file, int cycle, std::string version, double tolerance) {
WB3(slater_inverse, dim, u, col_update_index); WB3(slater_inverse, dim, u, col_update_index);
} else if (version == "smwb1") { } else if (version == "smwb1") {
SMWB1(slater_inverse, dim, nupdates, u, col_update_index); SMWB1(slater_inverse, dim, nupdates, u, col_update_index);
// } else if (version == "smwb2") {
// SMWB2(slater_inverse, dim, nupdates, u, col_update_index);
// } else if (version == "smwb3") {
// SMWB3(slater_inverse, dim, nupdates, u, col_update_index);
} else if (version == "smwb4") { } else if (version == "smwb4") {
SMWB4(slater_inverse, dim, nupdates, u, col_update_index); SMWB4(slater_inverse, dim, nupdates, u, col_update_index);
#ifdef MKL #ifdef MKL