Skip to content
Snippets Groups Projects
Commit ce535e43 authored by Mathieu Valois's avatar Mathieu Valois
Browse files

Fix wrong job distribution

parent 2a3c41cd
Branches
No related tags found
No related merge requests found
Pipeline #6325 passed
......@@ -23,9 +23,6 @@
#include "ThreadData.h"
#pragma omp declare reduction(dataSum: ThreadData : omp_out += omp_in ) initializer(omp_priv(omp_orig))
struct PasswordStats {
int pass_length = 0;
std::string advancedmask_string = "";
......
......@@ -11,6 +11,7 @@
typedef std::unordered_map<std::string, uint64_t> StringOccurrence;
typedef std::unordered_map<int, uint64_t> IntOccurrence;
/**
* @brief minimal number of digits of a password, etc.
*/
......@@ -61,4 +62,6 @@ struct ThreadData {
SecurityRules sr;
};
#pragma omp declare reduction(dataSum: ThreadData : omp_out += omp_in ) initializer(omp_priv(omp_orig))
#endif // THREAD_DATA_H
\ No newline at end of file
......@@ -70,22 +70,24 @@ int Statsgen::generate_stats() {
}
started = true;
#pragma omp parallel
#pragma omp parallel reduction(dataSum:results)
{
#pragma omp single
{
nbThread = omp_get_num_threads();
}
uint thread_id = omp_get_thread_num();
ifstream inputfile(filename);
string line;
#pragma omp for schedule(dynamic) private(line) reduction(dataSum:results)
for(uint numline = 0; numline < nblines; ++numline){
getline(inputfile, line);
if((numline % nbThread) == thread_id){
handle_password(line, 1, results);
#pragma omp atomic
++processed;
}
}
}
finished = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment