Fixed unsigned int/uint64_t/H5::PredType::STD_U32LE problem in qmckl_test_h5.cpp that caused the segmentation faults due to array indices running out of bounds. Naive Sherman-Morrison and Woodbury 2x2 kernels are working correctly from QMCkl with good accuracy.

Residual = sm1 23 2.665e-07 5.85161e-13
ok -- cycle 23
Residual = qmckl_sm1 23 2.665e-07 5.85161e-13
ok -- cycle 23
Residual = wb2 23 2.665e-07 5.85161e-13
ok -- cycle 23
Residual = qmckl_wb2 23 2.665e-07 5.85161e-13
ok -- cycle 23
This commit is contained in:
Francois Coppens 2021-07-22 10:20:29 +02:00
parent 675f5bef41
commit e188871df4
2 changed files with 6 additions and 6 deletions

2
qmckl

@ -1 +1 @@
Subproject commit 11eee81f847c07047629332fd0012d55ae2945e2 Subproject commit fdb8f5d50a47537b85fda5f64cc35fcd10683bd9

View File

@ -21,7 +21,7 @@ const H5std_string FILE_NAME("dataset.hdf5");
void read_int(H5::H5File file, std::string key, uint64_t *data) { void read_int(H5::H5File file, std::string key, uint64_t *data) {
H5::DataSet ds = file.openDataSet(key); H5::DataSet ds = file.openDataSet(key);
ds.read(data, H5::PredType::STD_U32LE); ds.read(data, H5::PredType::STD_U64LE);
ds.close(); ds.close();
} }
@ -72,7 +72,7 @@ int test_cycle(H5::H5File file, int cycle, std::string version, double tolerance
#ifdef PERF #ifdef PERF
double *slater_inverse_nonpersistent = new double[dim * dim]; double *slater_inverse_nonpersistent = new double[dim * dim];
if (version == "sm1") { if (version == "qmckl_sm1") {
for (unsigned int i = 0; i < repetition_number; i++) { for (unsigned int i = 0; i < repetition_number; i++) {
memcpy(slater_inverse_nonpersistent, slater_inverse, memcpy(slater_inverse_nonpersistent, slater_inverse,
dim * dim * sizeof(double)); dim * dim * sizeof(double));
@ -83,7 +83,7 @@ int test_cycle(H5::H5File file, int cycle, std::string version, double tolerance
u, col_update_index, slater_inverse_nonpersistent); u, col_update_index, slater_inverse_nonpersistent);
} }
} }
else if (version == "wb2") { else if (version == "qmckl_wb2") {
for (unsigned int i = 0; i < repetition_number; i++) { for (unsigned int i = 0; i < repetition_number; i++) {
memcpy(slater_inverse_nonpersistent, slater_inverse, memcpy(slater_inverse_nonpersistent, slater_inverse,
dim * dim * sizeof(double)); dim * dim * sizeof(double));
@ -102,14 +102,14 @@ int test_cycle(H5::H5File file, int cycle, std::string version, double tolerance
dim * dim * sizeof(double)); dim * dim * sizeof(double));
delete[] slater_inverse_nonpersistent; delete[] slater_inverse_nonpersistent;
#else // No performance measurements repetition #else // No performance measurements repetition
if (version == "sm1") { if (version == "qmckl_sm1") {
qmckl_context context; qmckl_context context;
context = qmckl_context_create(); context = qmckl_context_create();
qmckl_exit_code rc; qmckl_exit_code rc;
rc = qmckl_sherman_morrison_c(context, dim, nupdates, rc = qmckl_sherman_morrison_c(context, dim, nupdates,
u, col_update_index, slater_inverse); u, col_update_index, slater_inverse);
} }
else if (version == "wb2") { else if (version == "qmckl_wb2") {
qmckl_context context; qmckl_context context;
context = qmckl_context_create(); context = qmckl_context_create();
qmckl_exit_code rc; qmckl_exit_code rc;