Skip to content

Commit

Permalink
Merge branch 'main' into export-D57372738
Browse files Browse the repository at this point in the history
  • Loading branch information
ramilbakhshyiev committed May 15, 2024
2 parents 6d2bc99 + 745bca8 commit b0266c2
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 100 deletions.
175 changes: 88 additions & 87 deletions benchs/bench_cppcontrib_sa_decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ static void verifyIndex2LevelDecoder(
// evaluate the error
double error = getError(n, d, outputFaiss, outputKernel1);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "store_seq" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel << "\t" << error << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\tstore_seq\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel
<< "\t" << error << std::endl;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -261,10 +261,9 @@ static void verifyIndex2LevelDecoder(

// evaluate the error
const double error = getError(n, d, outputFaiss, outputKernel1);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "store_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel << "\t" << error << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\tstore_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel
<< "\t" << error << std::endl;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -324,9 +323,9 @@ static void verifyIndex2LevelDecoder(
// evaluate the error
const double error1 = getError(n, d, outputFaiss, outputKernel1);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel1 << "\t" << error1 << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel1
<< "\t" << error1 << std::endl;

// kernels: accum 2 points, shared centroids
StopWatch swKernel2;
Expand All @@ -353,9 +352,9 @@ static void verifyIndex2LevelDecoder(
// evaluate the error
const double error2 = getError(n, d, outputFaiss, outputKernel2);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum2_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel2 << "\t" << error2 << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum2_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel2
<< "\t" << error2 << std::endl;

// kernels: accum 2 points, unique centroids
StopWatch swKernel2u;
Expand Down Expand Up @@ -384,9 +383,9 @@ static void verifyIndex2LevelDecoder(
// evaluate the error
const double error2u = getError(n, d, outputFaiss, outputKernel2u);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum2u_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel2u << "\t" << error2u << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum2u_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel2u
<< "\t" << error2u << std::endl;

// kernels: accum 3 points, shared centroids
StopWatch swKernel3;
Expand Down Expand Up @@ -418,9 +417,9 @@ static void verifyIndex2LevelDecoder(
// evaluate the error
const double error3 = getError(n, d, outputFaiss, outputKernel3);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum3_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel3 << "\t" << error3 << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum3_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel3
<< "\t" << error3 << std::endl;

// kernels: accum 3 points, unique centroids
StopWatch swKernel3u;
Expand Down Expand Up @@ -456,9 +455,9 @@ static void verifyIndex2LevelDecoder(
// evaluate the error
const double error3u = getError(n, d, outputFaiss, outputKernel3u);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum3u_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel3u << "\t" << error3u << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum3u_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel3u
<< "\t" << error3u << std::endl;
}
}

Expand Down Expand Up @@ -524,9 +523,9 @@ static void verifyMinMaxIndex2LevelDecoder(
// evaluate the error
double error = getError(n, d, outputFaiss, outputKernel1);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "store_seq" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel << "\t" << error << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\tstore_seq\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel
<< "\t" << error << std::endl;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -573,9 +572,9 @@ static void verifyMinMaxIndex2LevelDecoder(
// evaluate the error
const double error = getError(n, d, outputFaiss, outputKernel1);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "store_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel << "\t" << error << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\tstore_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel
<< "\t" << error << std::endl;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -641,9 +640,9 @@ static void verifyMinMaxIndex2LevelDecoder(
// evaluate the error
const double error1 = getError(n, d, outputFaiss, outputKernel1);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel1 << "\t" << error1 << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel1
<< "\t" << error1 << std::endl;

// kernels: accum 2 points, shared centroids
StopWatch swKernel2;
Expand Down Expand Up @@ -675,9 +674,9 @@ static void verifyMinMaxIndex2LevelDecoder(
// evaluate the error
const double error2 = getError(n, d, outputFaiss, outputKernel2);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum2_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel2 << "\t" << error2 << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum2_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel2
<< "\t" << error2 << std::endl;

// kernels: accum 2 points, unique centroids
StopWatch swKernel2u;
Expand Down Expand Up @@ -711,9 +710,9 @@ static void verifyMinMaxIndex2LevelDecoder(
// evaluate the error
const double error2u = getError(n, d, outputFaiss, outputKernel2u);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum2u_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel2u << "\t" << error2u << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum2u_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel2u
<< "\t" << error2u << std::endl;

// kernels: accum 3 points, shared centroids
StopWatch swKernel3;
Expand Down Expand Up @@ -750,9 +749,9 @@ static void verifyMinMaxIndex2LevelDecoder(
// evaluate the error
const double error3 = getError(n, d, outputFaiss, outputKernel3);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum3_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel3 << "\t" << error3 << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum3_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel3
<< "\t" << error3 << std::endl;

// kernels: accum 3 points, unique centroids
StopWatch swKernel3u;
Expand Down Expand Up @@ -793,9 +792,9 @@ static void verifyMinMaxIndex2LevelDecoder(
// evaluate the error
const double error3u = getError(n, d, outputFaiss, outputKernel3u);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum3u_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel3u << "\t" << error3u << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum3u_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel3u
<< "\t" << error3u << std::endl;
}
}

Expand Down Expand Up @@ -851,9 +850,9 @@ static void verifyIndexPQDecoder(
// evaluate the error
double error = getError(n, d, outputFaiss, outputKernel1);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "store_seq" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel << "\t" << error << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\tstore_seq\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel
<< "\t" << error << std::endl;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -899,9 +898,9 @@ static void verifyIndexPQDecoder(
// evaluate the error
const double error = getError(n, d, outputFaiss, outputKernel1);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "store_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel << "\t" << error << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\tstore_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel
<< "\t" << error << std::endl;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -961,9 +960,9 @@ static void verifyIndexPQDecoder(
// evaluate the error
const double error1 = getError(n, d, outputFaiss, outputKernel1);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel1 << "\t" << error1 << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel1
<< "\t" << error1 << std::endl;

// kernels: accum 2 points, shared centroids
StopWatch swKernel2;
Expand All @@ -989,9 +988,9 @@ static void verifyIndexPQDecoder(
// evaluate the error
const double error2 = getError(n, d, outputFaiss, outputKernel2);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum2_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel2 << "\t" << error2 << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum2_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel2
<< "\t" << error2 << std::endl;

// kernels: accum 2 points, unique centroids
StopWatch swKernel2u;
Expand All @@ -1018,9 +1017,9 @@ static void verifyIndexPQDecoder(
// evaluate the error
const double error2u = getError(n, d, outputFaiss, outputKernel2u);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum2u_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel2u << "\t" << error2u << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum2u_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel2u
<< "\t" << error2u << std::endl;

// kernels: accum 3 points, shared centroids
StopWatch swKernel3;
Expand Down Expand Up @@ -1051,9 +1050,9 @@ static void verifyIndexPQDecoder(
// evaluate the error
const double error3 = getError(n, d, outputFaiss, outputKernel3);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum3_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel3 << "\t" << error3 << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum3_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel3
<< "\t" << error3 << std::endl;

// kernels: accum 3 points, unique centroids
StopWatch swKernel3u;
Expand Down Expand Up @@ -1086,9 +1085,9 @@ static void verifyIndexPQDecoder(
// evaluate the error
const double error3u = getError(n, d, outputFaiss, outputKernel3u);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum3u_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel3u << "\t" << error3u << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum3u_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel3u
<< "\t" << error3u << std::endl;
}
}

Expand Down Expand Up @@ -1149,9 +1148,9 @@ static void verifyMinMaxIndexPQDecoder(
// evaluate the error
double error = getError(n, d, outputFaiss, outputKernel1);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "store_seq" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel << "\t" << error << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\tstore_seq\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel
<< "\t" << error << std::endl;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1197,9 +1196,9 @@ static void verifyMinMaxIndexPQDecoder(
// evaluate the error
const double error = getError(n, d, outputFaiss, outputKernel1);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "store_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel << "\t" << error << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\tstore_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel
<< "\t" << error << std::endl;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1264,9 +1263,9 @@ static void verifyMinMaxIndexPQDecoder(
// evaluate the error
const double error1 = getError(n, d, outputFaiss, outputKernel1);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel1 << "\t" << error1 << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel1
<< "\t" << error1 << std::endl;

// kernels: accum 2 points, shared centroids
StopWatch swKernel2;
Expand Down Expand Up @@ -1297,9 +1296,9 @@ static void verifyMinMaxIndexPQDecoder(
// evaluate the error
const double error2 = getError(n, d, outputFaiss, outputKernel2);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum2_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel2 << "\t" << error2 << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum2_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel2
<< "\t" << error2 << std::endl;

// kernels: accum 2 points, unique centroids
StopWatch swKernel2u;
Expand Down Expand Up @@ -1331,9 +1330,9 @@ static void verifyMinMaxIndexPQDecoder(
// evaluate the error
const double error2u = getError(n, d, outputFaiss, outputKernel2u);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum2u_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel2u << "\t" << error2u << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum2u_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel2u
<< "\t" << error2u << std::endl;

// kernels: accum 3 points, shared centroids
StopWatch swKernel3;
Expand Down Expand Up @@ -1369,9 +1368,9 @@ static void verifyMinMaxIndexPQDecoder(
// evaluate the error
const double error3 = getError(n, d, outputFaiss, outputKernel3);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum3_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel3 << "\t" << error3 << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum3_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel3
<< "\t" << error3 << std::endl;

// kernels: accum 3 points, unique centroids
StopWatch swKernel3u;
Expand Down Expand Up @@ -1409,9 +1408,9 @@ static void verifyMinMaxIndexPQDecoder(
// evaluate the error
const double error3u = getError(n, d, outputFaiss, outputKernel3u);

std::cout << description << "\t" << n << "\t" << d << "\t"
<< "accum3u_rnd" << "\t" << nIterations << "\t" << timeFaiss
<< "\t" << timeKernel3u << "\t" << error3u << std::endl;
std::cout << description << "\t" << n << "\t" << d << "\taccum3u_rnd\t"
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel3u
<< "\t" << error3u << std::endl;
}
}

Expand Down Expand Up @@ -1484,8 +1483,10 @@ int main(int argc, char** argv) {
(N_ITERATIONS % 6) == 0, "Number of iterations should be 6*x");

// print the header
std::cout << "Codec\t" << "n\t" << "d\t" << "Experiment\t" << "Iterations\t"
<< "Faiss time\t" << "SADecodeKernel time\t" << "Error"
auto delim = "\t";
std::cout << "Codec" << delim << "n" << delim << "d" << delim
<< "Experiment" << delim << "Iterations" << delim << "Faiss time"
<< delim << "SADecodeKernel time" << delim << "Error"
<< std::endl;

// The following experiment types are available:
Expand Down
4 changes: 0 additions & 4 deletions faiss/IndexIVFFastScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,10 +914,6 @@ void IndexIVFFastScan::search_implem_10(
size_t* nlist_out,
const NormTableScaler* scaler,
const IVFSearchParameters* params) const {
const size_t max_codes = params ? params->max_codes : this->max_codes;
const SearchParameters* quantizer_params =
params ? params->quantizer_params : nullptr;

size_t dim12 = ksub * M2;
AlignedTable<uint8_t> dis_tables;
AlignedTable<uint16_t> biases;
Expand Down
Loading

0 comments on commit b0266c2

Please sign in to comment.