From 18eff17773f3d0e47328ce5b9e1db2780766ff3f Mon Sep 17 00:00:00 2001 From: Max Luebke Date: Fri, 31 Mar 2023 14:57:05 +0200 Subject: [PATCH 1/3] build: remove crypto library as dependency --- src/CMakeLists.txt | 2 +- src/ChemistryModule/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 69efdf196..09e85f790 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,7 +10,7 @@ find_library(CRYPTO_LIBRARY crypto) add_library(poet_lib ${poet_lib_SRC}) target_include_directories(poet_lib PUBLIC ${PROJECT_SOURCE_DIR}/include) target_link_libraries(poet_lib PUBLIC - MPI::MPI_CXX ${MATH_LIBRARY} ${CRYPTO_LIBRARY} RRuntime tug PhreeqcRM DataStructures ChemistryModule) + MPI::MPI_CXX ${MATH_LIBRARY} RRuntime tug PhreeqcRM DataStructures ChemistryModule) target_compile_definitions(poet_lib PUBLIC STRICT_R_HEADERS OMPI_SKIP_MPICXX) add_subdirectory(ChemistryModule) diff --git a/src/ChemistryModule/CMakeLists.txt b/src/ChemistryModule/CMakeLists.txt index 5736fbfa6..27068b315 100644 --- a/src/ChemistryModule/CMakeLists.txt +++ b/src/ChemistryModule/CMakeLists.txt @@ -18,7 +18,7 @@ add_library(ChemistryModule ${CHEM_MODEL_SRC}) target_include_directories(ChemistryModule PUBLIC ${PROJECT_SOURCE_DIR}/include) target_link_libraries(ChemistryModule PUBLIC MPI::MPI_CXX PhreeqcRM - PRIVATE ${MATH_LIBRARY} ${CRYPTO_LIBRARY} + PRIVATE ${MATH_LIBRARY} ) target_compile_definitions(ChemistryModule PUBLIC OMPI_SKIP_MPICXX) From 9f290d584a126fcec90844182e7e8d384e0fc26f Mon Sep 17 00:00:00 2001 From: Max Luebke Date: Fri, 31 Mar 2023 15:00:19 +0200 Subject: [PATCH 2/3] fix: remove openssl includes --- include/poet/HashFunctions.hpp | 7 +---- src/ChemistryModule/DHT_Wrapper.cpp | 3 -- src/ChemistryModule/HashFunctions.cpp | 40 +-------------------------- 3 files changed, 2 insertions(+), 48 deletions(-) diff --git a/include/poet/HashFunctions.hpp b/include/poet/HashFunctions.hpp index 1a7b1c4f1..49e86559a 100644 --- a/include/poet/HashFunctions.hpp +++ b/include/poet/HashFunctions.hpp @@ -1,4 +1,4 @@ -// // Time-stamp: "Last modified 2023-03-27 14:51:05 mluebke" +// // Time-stamp: "Last modified 2023-03-31 14:59:49 mluebke" /* ** Copyright (C) 2018-2021 Alexander Lindemann, Max Luebke (University of @@ -24,17 +24,12 @@ #define HASHFUNCTIONS_H_ #include -#include namespace poet { // Sum of POET interpreted as ASCII constexpr uint32_t HASH_SEED = 80 + 79 + 69 + 84; -void initHashCtx(const EVP_MD *md); -void freeHashCtx(); - -uint64_t hashDHT(int key_size, const void *key); uint64_t Murmur2_64A(int len, const void *key); } // namespace poet diff --git a/src/ChemistryModule/DHT_Wrapper.cpp b/src/ChemistryModule/DHT_Wrapper.cpp index 27e975f1a..d3e33999a 100644 --- a/src/ChemistryModule/DHT_Wrapper.cpp +++ b/src/ChemistryModule/DHT_Wrapper.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -71,7 +70,6 @@ void poet::DHT_ResultObject::ResultsToWP(std::vector &curr_wp) { DHT_Wrapper::DHT_Wrapper(MPI_Comm dht_comm, uint32_t dht_size, uint32_t key_count, uint32_t data_count) : key_count(key_count), data_count(data_count) { - poet::initHashCtx(EVP_md5()); // initialize DHT object uint32_t key_size = key_count * sizeof(DHT_Keyelement); uint32_t data_size = data_count * sizeof(double); @@ -100,7 +98,6 @@ DHT_Wrapper::~DHT_Wrapper() { // free DHT DHT_free(dht_object, NULL, NULL); - poet::freeHashCtx(); } auto DHT_Wrapper::checkDHT(int length, double dt, const std::vector &work_package) diff --git a/src/ChemistryModule/HashFunctions.cpp b/src/ChemistryModule/HashFunctions.cpp index 79a8773cd..da6e10138 100644 --- a/src/ChemistryModule/HashFunctions.cpp +++ b/src/ChemistryModule/HashFunctions.cpp @@ -1,4 +1,4 @@ -// Time-stamp: "Last modified 2023-03-27 14:50:53 mluebke" +// Time-stamp: "Last modified 2023-03-31 15:00:11 mluebke" /* **----------------------------------------------------------------------------- ** MurmurHash2 was written by Austin Appleby, and is placed in the public @@ -27,8 +27,6 @@ #include "poet/HashFunctions.hpp" #include -#include -#include #include #if defined(_MSC_VER) @@ -43,42 +41,6 @@ #endif // !defined(_MSC_VER) -// HACK: I know this is not a good practice, but this will do it for now! -EVP_MD_CTX *ctx = NULL; - -void poet::initHashCtx(const EVP_MD *md) { - if (ctx == NULL) { - ctx = EVP_MD_CTX_new(); - EVP_DigestInit_ex(ctx, md, NULL); - } -} - -void poet::freeHashCtx() { - EVP_MD_CTX_free(ctx); - ctx = NULL; -} - -uint64_t poet::hashDHT(int key_size, const void *key) { - unsigned char sum[MD5_DIGEST_LENGTH]; - uint32_t md_len; - uint64_t retval, *v1, *v2; - - // calculate md5 using MD5 functions - EVP_DigestUpdate(ctx, key, key_size); - EVP_DigestFinal_ex(ctx, sum, &md_len); - - if (md_len != MD5_DIGEST_LENGTH) { - throw std::runtime_error("Something went wrong during MD5 hashing!"); - } - - // divide hash in 2 64 bit parts and XOR them - v1 = (uint64_t *)&sum[0]; - v2 = (uint64_t *)&sum[8]; - retval = *v1 ^ *v2; - - return retval; -} - //----------------------------------------------------------------------------- // MurmurHash2, 64-bit versions, by Austin Appleby From b3323e01a1e9adf73e5c7dfb02ddf8171d1b3c1e Mon Sep 17 00:00:00 2001 From: Max Luebke Date: Fri, 31 Mar 2023 14:43:02 +0200 Subject: [PATCH 3/3] ci: improve ci ci: add image to repository container registry --- .gitlab-ci.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 461544dde..1f5313088 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,7 @@ # This specific template is located at: # https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml -image: git.gfz-potsdam.de:5000/sec34/port:builder +image: git.gfz-potsdam.de:5000/naaice/poet:ci stages: # List of stages for jobs, and their order of execution - build @@ -32,16 +32,20 @@ build-poet: # This job runs in the build stage, which runs first. stage: build script: - mkdir build && cd build - - cmake .. + - cmake -DPOET_ENABLE_TESTING=ON .. - make -j$(nproc) rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + artifacts: + paths: + - build test-poet: stage: test + dependencies: + - build-poet script: - - mkdir build_test && cd build_test - - cmake -DPOET_ENABLE_TESTING=ON .. + - cd build - make -j$(nproc) check rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' @@ -101,12 +105,14 @@ release-create: pages: stage: release + dependencies: + - build-poet before_script: - apt-get update && apt-get install -y doxygen graphviz - - mkdir {public,build} + - mkdir public script: - pushd build - - cmake .. && make doxygen + - make doxygen - popd && mv build/docs/html/* public/ artifacts: paths: