change handling of compiler macro

This commit is contained in:
Max Lübke 2021-02-01 10:57:51 +01:00
parent b85575a69b
commit dfa81b7fdd
3 changed files with 8 additions and 11 deletions

View File

@ -1,10 +1,10 @@
#include "DHT.h"
#include <inttypes.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <unistd.h>
static void determine_dest(uint64_t hash, int comm_size,
@ -79,7 +79,7 @@ DHT *DHT_create(MPI_Comm comm, uint64_t size, unsigned int data_size,
object->recv_entry = malloc(1 + data_size + key_size);
object->send_entry = malloc(1 + data_size + key_size);
object->index_count = 9 - (index_bytes / 8);
object->index = (uint64_t*)malloc((object->index_count) * sizeof(uint64_t));
object->index = (uint64_t *)malloc((object->index_count) * sizeof(uint64_t));
object->mem_alloc = mem_alloc;
// if set, initialize dht_stats
@ -375,8 +375,8 @@ int DHT_free(DHT *table, int *eviction_counter, int *readerror_counter) {
return DHT_SUCCESS;
}
#ifdef DHT_STATISTICS
int DHT_print_statistics(DHT *table) {
#ifdef DHT_STATISTICS
int *written_buckets;
int *read_misses, sum_read_misses;
int *evictions, sum_evictions;
@ -476,5 +476,5 @@ int DHT_print_statistics(DHT *table) {
MPI_Barrier(table->communicator);
return DHT_SUCCESS;
#endif
}
#endif

View File

@ -250,9 +250,7 @@ extern int DHT_free(DHT* table, int* eviction_counter, int* readerror_counter);
* @return int Returns DHT_SUCCESS on success or DHT_MPI_ERROR on internal MPI
* error.
*/
#ifdef DHT_STATISTICS
extern int DHT_print_statistics(DHT* table);
#endif
/**
* @brief Determine destination rank and index.

View File

@ -8,7 +8,7 @@
using namespace poet;
using namespace std;
uint64_t get_md5(int key_size, void *key) {
static uint64_t get_md5(int key_size, void *key) {
MD5_CTX ctx;
unsigned char sum[MD5_DIGEST_LENGTH];
uint64_t retval, *v1, *v2;
@ -120,9 +120,7 @@ int DHT_Wrapper::fileToTable(const char *filename) {
void DHT_Wrapper::printStatistics() {
int res;
#ifdef DHT_STATISTICS
res = DHT_print_statistics(dht_object);
#endif
if (res != DHT_SUCCESS) {
// MPI ERROR ... WHAT TO DO NOW?
@ -143,11 +141,12 @@ void DHT_Wrapper::fuzzForDHT(int var_count, void *key, double dt) {
if (dht_prop_type_vector[i] == "act") {
// with log10
if (dht_log) {
if (((double *)key)[i] < 0)
if (((double *)key)[i] < 0) {
cerr << "dht_wrapper.cpp::fuzz_for_dht(): Warning! Negative value in "
"key!"
<< endl;
else if (((double *)key)[i] == 0)
fuzzing_buffer[i] = 0;
} else if (((double *)key)[i] == 0)
fuzzing_buffer[i] = 0;
else
fuzzing_buffer[i] =