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
ifeq ($(ENV),INTEL)
CXX = icpc
CXX = icpx
FC = ifort
ARCH = -march=native
OPT = -O3
@ -15,7 +15,7 @@ else ifeq ($(ENV),GNU)
CXX = g++
FC = gfortran
ARCH = -mavx
OPT = -O0
OPT = -O3
DEBUG = -g
else
$(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,
unsigned int *Updates_index);
// // 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
// Sherman-Morrison-Woodbury kernel 2
// 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,
unsigned int *Updates_index);

View File

@ -27,20 +27,23 @@ export SMROOT
case $ENV in
intel)
echo "* SM build environment set to 'intel'"
export HDF5_CXX=icpc
export HDF5_CXXLINKER=icpc
export HDF5_CXX=icpx
export HDF5_CXXLINKER=icpx
export HDF5_CLINKER=icpx
export ENV=INTEL
;;
llvm)
echo "* SM build environment set to 'llvm'"
export HDF5_CXX=clang++
export HDF5_CXXLINKER=clang++
export HDF5_CLINKER=clang++
export ENV=LLVM
;;
vfc)
echo "* SM build environment set to 'vfc'"
export HDF5_CXX=clang++
export HDF5_CXXLINKER=clang++
export HDF5_CLINKER=clang++
export ENV=LLVM
export VFC_BACKENDS="libinterflop_ieee.so --count-op"
;;
@ -48,6 +51,7 @@ case $ENV in
echo "* SM build environment set to 'gnu'"
export HDF5_CXX=g++
export HDF5_CXXLINKER=g++
export HDF5_CLINKER=g++
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
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,
unsigned int *Updates_index) {
#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) {
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) {
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
double det;
det = B0 * (B4 * B8 - B5 * B7) -
B1 * (B3 * B8 - B5 * B6) + B2 * (B3 * B7 - B4 * B6);
det = B0 * (B4 * B8 - B5 * B7) - B1 * (B3 * B8 - B5 * B6) +
B2 * (B3 * B7 - B4 * B6);
#ifdef DEBUG2
std::cerr << "Determinant of B = " << det << std::endl;
#endif
@ -150,15 +150,15 @@ bool WB3(double *Slater_inv, const unsigned int Dim, double *Updates,
// Compute B^{-1} with explicit formula for 3x3 inversion
double Binv[9], idet = 1.0 / det;
Binv[0] = (B4 * B8 - B7 * B5) * idet;
Binv[0] = (B4 * B8 - B7 * B5) * idet;
Binv[1] = -(B1 * B8 - B7 * B2) * idet;
Binv[2] = (B1 * B5 - B4 * B2) * idet;
Binv[2] = (B1 * B5 - B4 * B2) * idet;
Binv[3] = -(B3 * B8 - B6 * B5) * idet;
Binv[4] = (B0 * B8 - B6 * B2) * idet;
Binv[4] = (B0 * B8 - B6 * B2) * idet;
Binv[5] = -(B0 * B5 - B3 * B2) * idet;
Binv[6] = (B3 * B7 - B6 * B4) * idet;
Binv[6] = (B3 * B7 - B6 * B4) * idet;
Binv[7] = -(B0 * B7 - B6 * B1) * idet;
Binv[8] = (B0 * B4 - B3 * B1) * idet;
Binv[8] = (B0 * B4 - B3 * B1) * idet;
#ifdef DEBUG2
std::cerr << "Conditioning number of B = " << condition1(B, Binv, 3)
@ -198,10 +198,14 @@ bool WB3(double *Slater_inv, const unsigned int Dim, double *Updates,
extern "C" {
bool WB2_f(double **linSlater_inv, unsigned int *Dim, double **linUpdates,
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,
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));
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++) {
std::memcpy(slater_inverse_nonpersistent, slater_inverse,
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
} 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);
// } else if (version == "smwb3") {
// SMWB3(slater_inverse, dim, nupdates, u, col_update_index);
} else if (version == "smwb4") {
SMWB4(slater_inverse, dim, nupdates, u, col_update_index);
} else if (version == "smwb2") {
SMWB2(slater_inverse, dim, nupdates, u, col_update_index);
#ifdef MKL
} else if (version == "lapack") {
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);
} else if (version == "smwb1") {
SMWB1(slater_inverse_nonpersistent, dim, nupdates, u, col_update_index);
// } else if (version == "smwb2") {
// SMWB2(slater_inverse_nonpersistent, dim, nupdates, u,
// 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);
} else if (version == "smwb2") {
SMWB2(slater_inverse_nonpersistent, dim, nupdates, u, col_update_index);
#ifdef MKL
} else if (version == "lapack") {
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);
} else if (version == "smwb1") {
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") {
SMWB4(slater_inverse, dim, nupdates, u, col_update_index);
#ifdef MKL