Loading include/Statsgen.h +0 −3 Original line number Diff line number Diff line Loading @@ -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 = ""; Loading include/ThreadData.h +3 −0 Original line number Diff line number Diff line Loading @@ -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. */ Loading Loading @@ -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 src/core/Statsgen.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading
include/Statsgen.h +0 −3 Original line number Diff line number Diff line Loading @@ -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 = ""; Loading
include/ThreadData.h +3 −0 Original line number Diff line number Diff line Loading @@ -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. */ Loading Loading @@ -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
src/core/Statsgen.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -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; Loading