Skip to content

Commit

Permalink
Little fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanLucPons committed Jun 12, 2020
1 parent 8c56f26 commit 9090698
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define CONSTANTSH

// Release number
#define RELEASE "1.10(unstable)"
#define RELEASE "1.10"

// Use symmetry
//#define USE_SYMMETRY
Expand Down
2 changes: 1 addition & 1 deletion Kangaroo.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class Kangaroo {
uint64_t dMask;
uint32_t dpSize;
int32_t initDPSize;
int collisionInSameHerd;
uint64_t collisionInSameHerd;
std::vector<Point> keysToSearch;
Point keyToSearch;
Point keyToSearchNeg;
Expand Down
6 changes: 5 additions & 1 deletion Merge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,11 @@ bool Kangaroo::MergeWork(std::string& file1,std::string& file2,std::string& dest
}

if(printStat) {
::printf("Dead kangaroo: %d\n",collisionInSameHerd);
#ifdef WIN64
::printf("Dead kangaroo: %I64d\n",collisionInSameHerd);
#else
::printf("Dead kangaroo: %" PRId64 "\n",collisionInSameHerd);
#endif
::printf("Total f1+f2: DP count 2^%.2f\n",log2((double)nbDP));
} else {
offsetTime = time1 + time2;
Expand Down
31 changes: 22 additions & 9 deletions PartMerge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,13 +400,21 @@ bool Kangaroo::MergeWorkPartPart(std::string& part1Name,std::string& part2Name)

} else {

::printf("Dead kangaroo: %d\n",collisionInSameHerd);
#ifdef WIN64
::printf("Dead kangaroo: %I64d\n",collisionInSameHerd);
#else
::printf("Dead kangaroo: %" PRId64 "\n",collisionInSameHerd);
#endif
::printf("Total f1+f2: DP count 2^%.2f\n",log2((double)nbDP));
return true;

}

::printf("Dead kangaroo: %d\n",collisionInSameHerd);
#ifdef WIN64
::printf("Dead kangaroo: %I64d\n",collisionInSameHerd);
#else
::printf("Dead kangaroo: %" PRId64 "\n",collisionInSameHerd);
#endif
::printf("Total f1+f2: DP count 2^%.2f\n",log2((double)nbDP));

return false;
Expand Down Expand Up @@ -480,8 +488,7 @@ bool Kangaroo::FillEmptyPartFromFile(std::string& partName,std::string& fileName
// Save parts
for(int p = 0; p < MERGE_PART; p++) {

if(p%(MERGE_PART/64)==0)
::printf(".");
if(p % (MERGE_PART / 64) == 0) ::printf(".");

FILE *f = OpenPart(partName,"wb",p,false);
uint32_t hStart = p * (HASH_SIZE / MERGE_PART);
Expand Down Expand Up @@ -662,7 +669,7 @@ bool Kangaroo::MergeWorkPart(std::string& partName,std::string& file2,bool print

for(int part = 0; part < MERGE_PART && !endOfSearch; part++) {

if(part%4==0) ::printf(".");
if(part % (MERGE_PART / 64) == 0) ::printf(".");

uint32_t hStart = part * (HASH_SIZE / MERGE_PART);
uint32_t hStop = (part + 1) * (HASH_SIZE / MERGE_PART);
Expand All @@ -673,8 +680,6 @@ bool Kangaroo::MergeWorkPart(std::string& partName,std::string& file2,bool print

for(uint32_t h = hStart; h < hStop && !endOfSearch; h++) {

if(h % (HASH_SIZE / 64) == 0) ::printf(".");

int mStatus = HashTable::MergeH(h,f1,f2,f,&hDP,&hDuplicate,&d1,&type1,&d2,&type2);
switch(mStatus) {
case ADD_OK:
Expand Down Expand Up @@ -710,14 +715,22 @@ bool Kangaroo::MergeWorkPart(std::string& partName,std::string& file2,bool print

} else {

::printf("Dead kangaroo: %d\n",collisionInSameHerd);
#ifdef WIN64
::printf("Dead kangaroo: %I64d\n",collisionInSameHerd);
#else
::printf("Dead kangaroo: %" PRId64 "\n",collisionInSameHerd);
#endif
::printf("Total f1+f2: DP count 2^%.2f\n",log2((double)nbDP));
return true;

}

if(printStat) {
::printf("Dead kangaroo: %d\n",collisionInSameHerd);
#ifdef WIN64
::printf("Dead kangaroo: %I64d\n",collisionInSameHerd);
#else
::printf("Dead kangaroo: %" PRId64 "\n",collisionInSameHerd);
#endif
::printf("Total f1+f2: DP count 2^%.2f\n",log2((double)nbDP));
} else {
offsetTime = time1 + time2;
Expand Down
8 changes: 4 additions & 4 deletions Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,12 @@ void Kangaroo::ProcessServer() {
t1 = Timer::get_tick();

if(!endOfSearch)
printf("\r[Client %d][Kang 2^%.2f][DP Count 2^%.2f/2^%.2f][Dead %d][%s][%s] ",
printf("\r[Client %d][Kang 2^%.2f][DP Count 2^%.2f/2^%.2f][Dead %.0f][%s][%s] ",
connectedClient,
log2((double)totalRW),
log2((double)hashTable.GetNbItem()),
log2(expectedNbOp / pow(2.0,dpSize)),
collisionInSameHerd,
(double)collisionInSameHerd,
GetTimeStr(t1 - startTime).c_str(),
hashTable.GetSizeInfo().c_str()
);
Expand Down Expand Up @@ -311,11 +311,11 @@ void Kangaroo::Process(TH_PARAM *params,std::string unit) {
serverStatus.c_str()
);
} else {
printf("\r[%.2f %s][GPU %.2f %s][Count 2^%.2f][Dead %d][%s (Avg %s)][%s] ",
printf("\r[%.2f %s][GPU %.2f %s][Count 2^%.2f][Dead %.0f][%s (Avg %s)][%s] ",
avgKeyRate / 1000000.0,unit.c_str(),
avgGpuKeyRate / 1000000.0,unit.c_str(),
log2((double)count + offsetCount),
collisionInSameHerd,
(double)collisionInSameHerd,
GetTimeStr(t1 - startTime + offsetTime).c_str(),GetTimeStr(expectedTime).c_str(),
hashTable.GetSizeInfo().c_str()
);
Expand Down

0 comments on commit 9090698

Please sign in to comment.