Skip to content

Commit 82062e9

Browse files
author
Martin D. Weinberg
committed
More comments and output update with debugging info
1 parent 26a896c commit 82062e9

2 files changed

Lines changed: 36 additions & 26 deletions

File tree

expui/BiorthBasis.cc

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <algorithm>
22

3-
#include "quickdigest5.hpp"
4-
#include "YamlCheck.H"
3+
#include "quickdigest5.hpp" // for md5 hashing of Python modules
4+
#include "YamlCheck.H" // for YAML configuration checking
55
#include "EXPException.H"
66
#include "BiorthBasis.H"
77
#include "DiskModels.H"
@@ -13,8 +13,8 @@
1313
#endif
1414

1515
// Suppress HDF5 diagonostic messages from base layer when using
16-
// HighFive
17-
#define HDF5_QUIET
16+
// HighFive. This should be enabled unless one is debugging.
17+
// #define HDF5_QUIET
1818

1919
namespace BasisClasses
2020
{
@@ -1608,7 +1608,7 @@ namespace BasisClasses
16081608
// Mute HDF5 error messages
16091609
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
16101610

1611-
// Unmute (Restore)
1611+
// For unmute, use:
16121612
// H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data);
16131613
#endif
16141614

@@ -1710,18 +1710,21 @@ namespace BasisClasses
17101710
current_md5 = QuickDigest5::fileToHash(pyname + ".py");
17111711
} catch (const std::runtime_error& e) {
17121712
if (myid==0)
1713-
std::cerr << "Error: " << e.what() << std::endl;
1713+
std::cerr << "BiorthBasis::Cylindrical error: "
1714+
<< e.what() << ", error compuing pyname md5sum"
1715+
<< std::endl;
17141716
}
17151717

17161718
// Check that the md5sums match for the current Python
1717-
// module and the loaded Python module used to create the
1718-
// cache. If they do not match, force cache recomputation
1719-
// to ensure consistency with the current Python module.
1719+
// module and the Python module used to create the
1720+
// cache. If they do not match, force cache
1721+
// recomputation to ensure consistency with the current
1722+
// Python module.
17201723
if (current_md5 != pyinfo[1]) {
17211724
if (myid==0) {
17221725
std::cout << "---- Cylindrical: Python module for disk density has changed since cache creation." << std::endl
17231726
<< "---- Current module: <" << pyname << ">, md5sum: " << current_md5 << std::endl
1724-
<< "---- Loaded module: <" << pyinfo[0] << ">, md5sum: " << pyinfo[1] << std::endl
1727+
<< "---- Cached module: <" << pyinfo[0] << ">, md5sum: " << pyinfo[1] << std::endl
17251728
<< "---- Cylindrical: forcing cache recomputation to ensure consistency" << std::endl;
17261729
}
17271730
cache_status = 0;
@@ -1806,15 +1809,17 @@ namespace BasisClasses
18061809
current_md5 = QuickDigest5::fileToHash(pyproj + ".py");
18071810
} catch (const std::runtime_error& e) {
18081811
if (myid==0)
1809-
std::cerr << "Error: " << e.what() << std::endl;
1812+
std::cerr << "BiorthBasis::Cylindrical error: "
1813+
<< e.what() << ", error computing pyproj md5sum"
1814+
<< std::endl;
18101815
}
18111816
// Check that the md5sums match for the current Python projection
18121817
//
18131818
if (current_md5 != pyinfo[1]) {
18141819
if (myid==0) {
18151820
std::cout << "---- Cylindrical: Python module for deprojection has changed since cache creation." << std::endl
18161821
<< "---- Current module: <" << pyproj << ">, md5sum: " << current_md5 << std::endl
1817-
<< "---- Loaded module: <" << pyinfo[0] << ">, md5sum: " << pyinfo[1] << std::endl
1822+
<< "---- Cached module: <" << pyinfo[0] << ">, md5sum: " << pyinfo[1] << std::endl
18181823
<< "---- Cylindrical: forcing cache recomputation to ensure consistency" << std::endl;
18191824
}
18201825
cache_status = 0;
@@ -2028,8 +2033,10 @@ namespace BasisClasses
20282033

20292034
} catch (const std::runtime_error& e) {
20302035
if (myid==0) {
2031-
std::cerr << "Error: " << e.what() << std::endl;
2032-
std::cerr << "Can not write the md5 hash to HDF5" << std::endl;
2036+
std::cerr << "BiorthBasis::Cylindrical error: "
2037+
<< e.what()
2038+
<< ", can not write the pyname and md5 hash to HDF5"
2039+
<< std::endl;
20332040
}
20342041
}
20352042
}
@@ -2055,8 +2062,10 @@ namespace BasisClasses
20552062
<< "> to cache file <" << cachename << ">" << std::endl;
20562063
} catch (const std::runtime_error& e) {
20572064
if (myid==0) {
2058-
std::cerr << "Error: " << e.what() << std::endl;
2059-
std::cerr << "Can not write the md5 hash to HDF5" << std::endl;
2065+
std::cerr << "BiorthBasis::Cylindrical error: "
2066+
<< e.what()
2067+
<< ", can not write the pyinfo and md5 hash to HDF5"
2068+
<< std::endl;
20602069
}
20612070
}
20622071
}
@@ -2074,7 +2083,7 @@ namespace BasisClasses
20742083
}
20752084

20762085
#ifdef HDF5_QUIET
2077-
// Unmute HDF5 error messages (Restore)
2086+
// Unmute HDF5 error messages
20782087
H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data);
20792088
#endif
20802089
// Orthogonality sanity check

src/Cylinder.cc

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,18 +2080,18 @@ bool Cylinder::checkDtype()
20802080

20812081
std::string current_md5;
20822082

2083-
// Get the md5sum for requested Python module
2083+
// Get the md5sum for requested Python module source file
20842084
try {
20852085
current_md5 = QuickDigest5::fileToHash(pyname);
20862086
} catch (const std::runtime_error& e) {
20872087
if (myid==0)
20882088
std::cerr << "Error: " << e.what() << std::endl;
20892089
}
20902090

2091-
// Check that the md5sums match for the current Python
2092-
// module and the loaded Python module used to create the
2093-
// cache. If they do not match, force cache recomputation
2094-
// to ensure consistency with the current Python module.
2091+
// Check that the md5sums match for the current Python module
2092+
// source files and the loaded Python module used to create the
2093+
// cache. If they do not match, force cache recomputation to
2094+
// ensure consistency with the current Python module.
20952095
if (current_md5 != pyinfo[1]) {
20962096
if (myid==0) {
20972097
std::cout << "---- Cylinder::checkDtype: Python module for disk density has changed since cache creation." << std::endl
@@ -2125,10 +2125,11 @@ void Cylinder::saveDtype()
21252125
("DiskType",
21262126
HighFive::DataSpace::From(dtype)).write(dtype);
21272127

2128-
// Write the md5sum for the Python module, if Python disk type is
2129-
// used. This will allow us to check for consistency between the
2130-
// Python module used to create the cache and the current Python
2131-
// module, and force cache recomputation if they do not match.
2128+
// Write the md5sum for the Python module source file, if Python
2129+
// disk type is used. This will allow us to check for consistency
2130+
// between the Python module used to create the cache and the
2131+
// current Python module, and force cache recomputation if they do
2132+
// not match.
21322133
//
21332134
if (DTYPE == DiskType::python) {
21342135
try {

0 commit comments

Comments
 (0)