Skip to content

Commit

Permalink
mac build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jevinskie committed Dec 28, 2018
1 parent 897f602 commit 8589a3c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ TARGET=daredevil
PREFIX=/usr/local
RESOURCES=$(PREFIX)/share/daredevil/
CC=clang++
CFLAGS=-Wall -Wextra -std=c++11 -O3 -DRESOURCES=\"$(RESOURCES)\"
CFLAGS=-Wall -Wextra -std=c++11 -Ofast -g -DRESOURCES=\"$(RESOURCES)\"
LIBS=-fopenmp -lm

OBJECTS = $(patsubst %.cpp, %.o, $(wildcard *.cpp))
Expand Down
10 changes: 5 additions & 5 deletions focpa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "focpa.h"
#include "socpa.h"

extern pthread_mutex_t lock;
extern pthread_mutex_t pt_lock;

/* Implements first order CPA in a faster and multithreaded way on big files,
* using the vertical partitioning approach.
Expand Down Expand Up @@ -124,7 +124,7 @@ int first_order(Config & conf)
}

FinalConfig<TypeTrace, TypeReturn, TypeGuess> fin_conf = FinalConfig<TypeTrace, TypeReturn, TypeGuess>(&mat_args, &conf, (void*)queues);
pthread_mutex_init(&lock, NULL);
pthread_mutex_init(&pt_lock, NULL);

vector<CorrFirstOrder<TypeReturn>*> sum_bit_corels;
vector<CorrFirstOrder<TypeReturn>*> peak_bit_corels;
Expand Down Expand Up @@ -368,7 +368,7 @@ int first_order(Config & conf)
free_matrix(&traces, ncol);
free_matrix(&tmp, max_n_rows);
free_matrix(&fin_conf.mat_args->guess, n_keys);
pthread_mutex_destroy(&lock);
pthread_mutex_destroy(&pt_lock);
return 0;
}

Expand Down Expand Up @@ -420,15 +420,15 @@ void * correlation_first_order(void * args_in)
q[k].key = k;
}

pthread_mutex_lock(&lock);
pthread_mutex_lock(&pt_lock);
for (int key=0; key < n_keys; key++) {
if (G->fin_conf->conf->key_size == 1)
queues->pqueue->insert(q[key]);
if (queues->top_corr[key] < q[key]){
queues->top_corr[key] = q[key];
}
}
pthread_mutex_unlock(&lock);
pthread_mutex_unlock(&pt_lock);
}
free (q);
return NULL;
Expand Down
14 changes: 7 additions & 7 deletions socpa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "utils.h"
#include "string.h"

pthread_mutex_t lock;
pthread_mutex_t pt_lock;

/* Implements second order CPA in a faster and multithreaded way on big files.
*
Expand Down Expand Up @@ -139,7 +139,7 @@ int second_order(Config & conf)
}

FinalConfig<TypeReturn, TypeReturn, TypeGuess> fin_conf = FinalConfig<TypeReturn, TypeReturn, TypeGuess>(&mat_args, &conf, (void*)queues);
pthread_mutex_init(&lock, NULL);
pthread_mutex_init(&pt_lock, NULL);


/* We loop over all the key bytes.
Expand Down Expand Up @@ -312,7 +312,7 @@ int second_order(Config & conf)
free_matrix(&traces, ncol);
free_matrix(&tmp, max_n_rows);
free_matrix(&fin_conf.mat_args->guess, n_keys);
pthread_mutex_destroy(&lock);
pthread_mutex_destroy(&pt_lock);
return 0;
}

Expand Down Expand Up @@ -489,15 +489,15 @@ void * second_order_correlation(void * args_in)
q[k].time2 = j + first_sample + offset;
q[k].key = k;
}
pthread_mutex_lock(&lock);
pthread_mutex_lock(&pt_lock);
for (int key=0; key < n_keys; key++) {
if (G->fin_conf->conf->key_size == 1)
queues->pqueue->insert(q[key]);
if (queues->top_corr[key] < q[key]){
queues->top_corr[key] = q[key];
}
}
pthread_mutex_unlock(&lock);
pthread_mutex_unlock(&pt_lock);

}
}
Expand Down Expand Up @@ -565,15 +565,15 @@ void * higher_moments_correlation(void * args_in)
q[k].time2 = i + first_sample + offset;
q[k].key = k;
}
pthread_mutex_lock(&lock);
pthread_mutex_lock(&pt_lock);
for (int key=0; key < n_keys; key++) {
if (G->fin_conf->conf->key_size == 1)
queues->pqueue->insert(q[key]);
if (queues->top_corr[key] < q[key]){
queues->top_corr[key] = q[key];
}
}
pthread_mutex_unlock(&lock);
pthread_mutex_unlock(&pt_lock);


}
Expand Down

0 comments on commit 8589a3c

Please sign in to comment.