Skip to content

Commit cc7f53e

Browse files
author
Martin D. Weinberg
committed
Added standalone md5 hash code to avoid problems with Mac and Windows down the line
1 parent 8dcc0a8 commit cc7f53e

7 files changed

Lines changed: 26 additions & 11 deletions

File tree

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
[submodule "extern/HighFive"]
99
path = extern/HighFive
1010
url = https://github.com/BlueBrain/HighFive.git
11+
[submodule "extern/QuickDigest5"]
12+
path = extern/QuickDigest5
13+
url = https://github.com/nthnn/QuickDigest5.git

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ execute_process(
259259

260260
include_directories(${PROJECT_SOURCE_DIR}/extern/yaml-cpp/include)
261261
include_directories(${PROJECT_SOURCE_DIR}/extern/pybind11/include)
262+
include_directories(${PROJECT_SOURCE_DIR}/extern/QuickDigest5/include)
262263

263264
# Report to the user
264265
message("Configuring build for ${GIT_BRANCH}/${GIT_COMMIT} at ${COMPILE_TIME}")

expui/BiorthBasis.cc

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

3+
#include "quickdigest5.hpp"
34
#include "YamlCheck.H"
45
#include "EXPException.H"
56
#include "BiorthBasis.H"
@@ -1654,7 +1655,7 @@ namespace BasisClasses
16541655

16551656
// Get the md5sum for requested Python module
16561657
try {
1657-
current_md5 = get_md5sum(pyname);
1658+
current_md5 = QuickDigest5::fileToHash(pyname);
16581659
} catch (const std::runtime_error& e) {
16591660
std::cerr << "Error: " << e.what() << std::endl;
16601661
}
@@ -1720,7 +1721,7 @@ namespace BasisClasses
17201721

17211722
// Get the md5sum for requested Python projection module
17221723
try {
1723-
current_md5 = get_md5sum(pyproj);
1724+
current_md5 = QuickDigest5::fileToHash(pyproj);
17241725
} catch (const std::runtime_error& e) {
17251726
std::cerr << "Error: " << e.what() << std::endl;
17261727
}
@@ -1933,7 +1934,8 @@ namespace BasisClasses
19331934
// Write the md5sum for the Python module
19341935
if (DTYPE == DiskType::python) {
19351936
try {
1936-
std::vector<std::string> pyinfo = {pyname, get_md5sum(pyname)};
1937+
std::string hash = QuickDigest5::fileToHash(pyname);
1938+
std::vector<std::string> pyinfo = {pyname, hash};
19371939
file.createAttribute<std::string>
19381940
("pythonDiskType", HighFive::DataSpace::From(pyinfo)).write(pyinfo);
19391941
} catch (const std::runtime_error& e) {
@@ -1954,7 +1956,8 @@ namespace BasisClasses
19541956

19551957
if (PTYPE == DeprojType::python) {
19561958
try {
1957-
std::vector<std::string> pyinfo = {pyproj, get_md5sum(pyproj)};
1959+
std::string hash = QuickDigest5::fileToHash(pyproj);
1960+
std::vector<std::string> pyinfo = {pyproj, hash};
19581961
file.createAttribute<std::string>
19591962
("pythonProjType",
19601963
HighFive::DataSpace::From(pyinfo)).write(pyinfo);

exputil/CMakeLists.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,21 @@ set(SLEDGE_SRC sledge.f)
4242
set(PARTICLE_SRC Particle.cc ParticleReader.cc header.cc)
4343
set(CUDA_SRC cudaParticle.cu cudaSLGridMP2.cu)
4444
set(PYWRAP_SRC DiskDensityFunc.cc)
45+
set(QD5_SRC ${PROJECT_SOURCE_DIR}/extern/QuickDigest5/src/quickdigest5.cpp)
4546

46-
set(exputil_SOURCES ${ODE_SRC} ${ROOT_SRC} ${QUAD_SRC}
47-
${RANDOM_SRC} ${UTIL_SRC} ${SPECFUNC_SRC}
48-
${PHASE_SRC} ${SYMP_SRC} ${INTERP_SRC} ${MASSMODEL_SRC}
49-
${ORBIT_SRC} ${BIORTH_SRC} ${POLY_SRC} ${GAUSS_SRC}
50-
${QPDISTF_SRC} ${BESSEL_SRC} ${OPTIMIZATION_SRC}
51-
${SLEDGE_SRC} ${PARTICLE_SRC} ${CUDA_SRC} ${PYWRAP_SRC})
47+
48+
set(exputil_SOURCES ${ODE_SRC} ${ROOT_SRC} ${QUAD_SRC} ${RANDOM_SRC}
49+
${UTIL_SRC} ${SPECFUNC_SRC} ${PHASE_SRC} ${SYMP_SRC} ${INTERP_SRC}
50+
${MASSMODEL_SRC} ${ORBIT_SRC} ${BIORTH_SRC} ${POLY_SRC} ${GAUSS_SRC}
51+
${QPDISTF_SRC} ${BESSEL_SRC} ${OPTIMIZATION_SRC} ${SLEDGE_SRC}
52+
${PARTICLE_SRC} ${CUDA_SRC} ${PYWRAP_SRC} ${QD5_SRC})
5253

5354
set(common_INCLUDE_DIRS $<INSTALL_INTERFACE:include>
5455
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>
5556
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/> ${CMAKE_BINARY_DIR}
5657
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/extern/yaml-cpp/include>
5758
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/extern/HighFive/include>
59+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/extern/QuickDigest5/include>
5860
${DEP_INC} ${EIGEN3_INCLUDE_DIR} ${HDF5_INCLUDE_DIRS}
5961
${FFTW_INCLUDE_DIRS})
6062

exputil/getmd5sum.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Initial reference implementation. Better to use QuickDigest5 which
2+
// is currently a git submodule.
3+
14
#include <string>
25
#include <cstdio>
36
#include <array>

extern/QuickDigest5

Submodule QuickDigest5 added at 1d61aec

utils/Test/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
set(bin_PROGRAMS testBarrier expyaml orthoTest testDeproj
3-
testEmpDeproj testEmp)
3+
testEmpDeproj testEmp testmd5)
44

55
set(common_LINKLIB OpenMP::OpenMP_CXX MPI::MPI_CXX expui exputil
66
yaml-cpp ${VTK_LIBRARIES})
@@ -11,6 +11,7 @@ endif()
1111

1212
set(common_INCLUDE
1313
$<INSTALL_INTERFACE:include>
14+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/extern/QuickDigest5/include>
1415
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>
1516
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/>
1617
${CMAKE_BINARY_DIR} ${DEP_INC}
@@ -37,6 +38,7 @@ add_executable(testDeproj testDeproject.cc CubicSpline.cc Deprojector.cc)
3738
add_executable(testEmpDeproj testEmpDeproj.cc CubicSpline.cc
3839
Deprojector.cc EmpDeproj.cc)
3940
add_executable(testEmp testEmp.cc EmpDeproj.cc)
41+
add_executable(testmd5 testmd5.cc)
4042

4143
foreach(program ${bin_PROGRAMS})
4244
target_link_libraries(${program} ${common_LINKLIB})

0 commit comments

Comments
 (0)