From e188871df463a5933873f9b3fa6a5208bfae7dc3 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Thu, 22 Jul 2021 10:20:29 +0200 Subject: [PATCH] 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 --- qmckl | 2 +- tests/qmckl_test_h5.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/qmckl b/qmckl index 11eee81..fdb8f5d 160000 --- a/qmckl +++ b/qmckl @@ -1 +1 @@ -Subproject commit 11eee81f847c07047629332fd0012d55ae2945e2 +Subproject commit fdb8f5d50a47537b85fda5f64cc35fcd10683bd9 diff --git a/tests/qmckl_test_h5.cpp b/tests/qmckl_test_h5.cpp index 99bbaca..93b64d2 100644 --- a/tests/qmckl_test_h5.cpp +++ b/tests/qmckl_test_h5.cpp @@ -21,7 +21,7 @@ const H5std_string FILE_NAME("dataset.hdf5"); void read_int(H5::H5File file, std::string key, uint64_t *data) { H5::DataSet ds = file.openDataSet(key); - ds.read(data, H5::PredType::STD_U32LE); + ds.read(data, H5::PredType::STD_U64LE); ds.close(); } @@ -72,7 +72,7 @@ int test_cycle(H5::H5File file, int cycle, std::string version, double tolerance #ifdef PERF double *slater_inverse_nonpersistent = new double[dim * dim]; - if (version == "sm1") { + if (version == "qmckl_sm1") { for (unsigned int i = 0; i < repetition_number; i++) { memcpy(slater_inverse_nonpersistent, slater_inverse, 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); } } - else if (version == "wb2") { + else if (version == "qmckl_wb2") { for (unsigned int i = 0; i < repetition_number; i++) { memcpy(slater_inverse_nonpersistent, slater_inverse, 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)); delete[] slater_inverse_nonpersistent; #else // No performance measurements repetition - if (version == "sm1") { + if (version == "qmckl_sm1") { qmckl_context context; context = qmckl_context_create(); qmckl_exit_code rc; rc = qmckl_sherman_morrison_c(context, dim, nupdates, u, col_update_index, slater_inverse); } - else if (version == "wb2") { + else if (version == "qmckl_wb2") { qmckl_context context; context = qmckl_context_create(); qmckl_exit_code rc;