feat: update
This commit is contained in:
parent
772a571793
commit
363945d56b
@ -12,6 +12,7 @@
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <bitset>
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
@ -32,6 +33,8 @@
|
||||
#define SET_THRESH 0.95f
|
||||
#define BITSET_SIZE 256// bitset used to exploit bitwise operations
|
||||
#define ROW_SET_CNT 5
|
||||
const uint64_t init_row_mask = LS_BITMASK(16);// use 16 bits for the row
|
||||
const uint64_t init_last_mask = (init_row_mask << (40 - 16));
|
||||
|
||||
// from
|
||||
// https://stackoverflow.com/questions/1644868/define-macro-for-debug-printing-in-c
|
||||
@ -301,8 +304,8 @@ find_row_mask(std::vector<set_t> &sets,
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t row_mask = LS_BITMASK(16);// use 16 bits for the row
|
||||
const uint64_t last_mask = (row_mask << (40 - 16));
|
||||
uint64_t row_mask = init_row_mask;
|
||||
const uint64_t last_mask = init_last_mask;
|
||||
row_mask <<= CL_SHIFT;// skip the lowest 6 bits since they're used for CL addressing
|
||||
bool need_update_row_mask = false;
|
||||
|
||||
@ -326,11 +329,11 @@ find_row_mask(std::vector<set_t> &sets,
|
||||
// }
|
||||
|
||||
std::vector<std::thread> workers;
|
||||
auto thread_num = cpu == 0 ? std::thread::hardware_concurrency() : cpu;
|
||||
if (thread_num > 2) { thread_num -= 2; }
|
||||
fprintf(stderr, "thread_num: %ld\n", thread_num);
|
||||
int thread_num = cpu == 0 ? std::thread::hardware_concurrency() : cpu;
|
||||
if (thread_num > 4) { thread_num -= 4; }
|
||||
fprintf(stderr, "thread_num: %d\n", thread_num);
|
||||
|
||||
uint64_t step = 100000000;
|
||||
uint64_t step = 1000000;
|
||||
// for (uint64_t i = row_mask; i < last_mask; ++step) { i = next_bit_permutation(i); }
|
||||
// fprintf(stderr, "total_step: %ld\n", step);
|
||||
// step /= thread_num;
|
||||
@ -457,7 +460,11 @@ rev_mc(size_t sets_cnt, size_t threshold, size_t rounds, size_t m_size, char *o_
|
||||
fprintf(stderr, "Start Find Function\n");
|
||||
fn_masks = find_functions(sets, 6, 30, flags);
|
||||
fprintf(stderr, "Start Find RowMask\n");
|
||||
auto start_tp = std::chrono::steady_clock::now();
|
||||
uint64_t row_mask = find_row_mask(sets, fn_masks, mem, threshold, flags, cpu);
|
||||
auto end_tp = std::chrono::steady_clock::now();
|
||||
uint64_t sec = std::chrono::duration_cast<std::chrono::seconds>(end_tp - start_tp).count();
|
||||
fprintf(stderr, "Find RowMask Cost: %ld sec.\n", sec);
|
||||
|
||||
free_buffer(&mem);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user