Merge branch 'fix-ci' into 'main'

Fix CI

See merge request naaice/poet!6
This commit is contained in:
Max Lübke 2023-03-31 15:21:23 +02:00
commit e29a4bff03
6 changed files with 16 additions and 56 deletions

View File

@ -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:

View File

@ -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 <cstdint>
#include <openssl/evp.h>
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

View File

@ -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)

View File

@ -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)

View File

@ -29,7 +29,6 @@
#include <cstring>
#include <iostream>
#include <math.h>
#include <openssl/evp.h>
#include <stdexcept>
#include <vector>
@ -71,7 +70,6 @@ void poet::DHT_ResultObject::ResultsToWP(std::vector<double> &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<double> &work_package)

View File

@ -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 <cstddef>
#include <openssl/evp.h>
#include <openssl/md5.h>
#include <stdexcept>
#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