Skip to content

Commit 745bca8

Browse files
mengdilinfacebook-github-bot
authored andcommitted
stabilize formatting for bench_cppcontrib_sa_decode.cpp (#3443)
Summary: Pull Request resolved: #3443 Stabilize this file for clang-formatting versions 18.1.3 (VSCode) and 18.1.5 (our Github CI) Reviewed By: junjieqi Differential Revision: D57393650 fbshipit-source-id: 15170436bbd03194dbeaac1ef1130e20adc8c23e
1 parent 2050a03 commit 745bca8

File tree

1 file changed

+88
-87
lines changed

1 file changed

+88
-87
lines changed

benchs/bench_cppcontrib_sa_decode.cpp

+88-87
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,9 @@ static void verifyIndex2LevelDecoder(
213213
// evaluate the error
214214
double error = getError(n, d, outputFaiss, outputKernel1);
215215

216-
std::cout << description << "\t" << n << "\t" << d << "\t"
217-
<< "store_seq" << "\t" << nIterations << "\t" << timeFaiss
218-
<< "\t" << timeKernel << "\t" << error << std::endl;
216+
std::cout << description << "\t" << n << "\t" << d << "\tstore_seq\t"
217+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel
218+
<< "\t" << error << std::endl;
219219
}
220220

221221
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -261,10 +261,9 @@ static void verifyIndex2LevelDecoder(
261261

262262
// evaluate the error
263263
const double error = getError(n, d, outputFaiss, outputKernel1);
264-
265-
std::cout << description << "\t" << n << "\t" << d << "\t"
266-
<< "store_rnd" << "\t" << nIterations << "\t" << timeFaiss
267-
<< "\t" << timeKernel << "\t" << error << std::endl;
264+
std::cout << description << "\t" << n << "\t" << d << "\tstore_rnd\t"
265+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel
266+
<< "\t" << error << std::endl;
268267
}
269268

270269
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -324,9 +323,9 @@ static void verifyIndex2LevelDecoder(
324323
// evaluate the error
325324
const double error1 = getError(n, d, outputFaiss, outputKernel1);
326325

327-
std::cout << description << "\t" << n << "\t" << d << "\t"
328-
<< "accum_rnd" << "\t" << nIterations << "\t" << timeFaiss
329-
<< "\t" << timeKernel1 << "\t" << error1 << std::endl;
326+
std::cout << description << "\t" << n << "\t" << d << "\taccum_rnd\t"
327+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel1
328+
<< "\t" << error1 << std::endl;
330329

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

356-
std::cout << description << "\t" << n << "\t" << d << "\t"
357-
<< "accum2_rnd" << "\t" << nIterations << "\t" << timeFaiss
358-
<< "\t" << timeKernel2 << "\t" << error2 << std::endl;
355+
std::cout << description << "\t" << n << "\t" << d << "\taccum2_rnd\t"
356+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel2
357+
<< "\t" << error2 << std::endl;
359358

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

387-
std::cout << description << "\t" << n << "\t" << d << "\t"
388-
<< "accum2u_rnd" << "\t" << nIterations << "\t" << timeFaiss
389-
<< "\t" << timeKernel2u << "\t" << error2u << std::endl;
386+
std::cout << description << "\t" << n << "\t" << d << "\taccum2u_rnd\t"
387+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel2u
388+
<< "\t" << error2u << std::endl;
390389

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

421-
std::cout << description << "\t" << n << "\t" << d << "\t"
422-
<< "accum3_rnd" << "\t" << nIterations << "\t" << timeFaiss
423-
<< "\t" << timeKernel3 << "\t" << error3 << std::endl;
420+
std::cout << description << "\t" << n << "\t" << d << "\taccum3_rnd\t"
421+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel3
422+
<< "\t" << error3 << std::endl;
424423

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

459-
std::cout << description << "\t" << n << "\t" << d << "\t"
460-
<< "accum3u_rnd" << "\t" << nIterations << "\t" << timeFaiss
461-
<< "\t" << timeKernel3u << "\t" << error3u << std::endl;
458+
std::cout << description << "\t" << n << "\t" << d << "\taccum3u_rnd\t"
459+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel3u
460+
<< "\t" << error3u << std::endl;
462461
}
463462
}
464463

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

527-
std::cout << description << "\t" << n << "\t" << d << "\t"
528-
<< "store_seq" << "\t" << nIterations << "\t" << timeFaiss
529-
<< "\t" << timeKernel << "\t" << error << std::endl;
526+
std::cout << description << "\t" << n << "\t" << d << "\tstore_seq\t"
527+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel
528+
<< "\t" << error << std::endl;
530529
}
531530

532531
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -573,9 +572,9 @@ static void verifyMinMaxIndex2LevelDecoder(
573572
// evaluate the error
574573
const double error = getError(n, d, outputFaiss, outputKernel1);
575574

576-
std::cout << description << "\t" << n << "\t" << d << "\t"
577-
<< "store_rnd" << "\t" << nIterations << "\t" << timeFaiss
578-
<< "\t" << timeKernel << "\t" << error << std::endl;
575+
std::cout << description << "\t" << n << "\t" << d << "\tstore_rnd\t"
576+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel
577+
<< "\t" << error << std::endl;
579578
}
580579

581580
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -641,9 +640,9 @@ static void verifyMinMaxIndex2LevelDecoder(
641640
// evaluate the error
642641
const double error1 = getError(n, d, outputFaiss, outputKernel1);
643642

644-
std::cout << description << "\t" << n << "\t" << d << "\t"
645-
<< "accum_rnd" << "\t" << nIterations << "\t" << timeFaiss
646-
<< "\t" << timeKernel1 << "\t" << error1 << std::endl;
643+
std::cout << description << "\t" << n << "\t" << d << "\taccum_rnd\t"
644+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel1
645+
<< "\t" << error1 << std::endl;
647646

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

678-
std::cout << description << "\t" << n << "\t" << d << "\t"
679-
<< "accum2_rnd" << "\t" << nIterations << "\t" << timeFaiss
680-
<< "\t" << timeKernel2 << "\t" << error2 << std::endl;
677+
std::cout << description << "\t" << n << "\t" << d << "\taccum2_rnd\t"
678+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel2
679+
<< "\t" << error2 << std::endl;
681680

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

714-
std::cout << description << "\t" << n << "\t" << d << "\t"
715-
<< "accum2u_rnd" << "\t" << nIterations << "\t" << timeFaiss
716-
<< "\t" << timeKernel2u << "\t" << error2u << std::endl;
713+
std::cout << description << "\t" << n << "\t" << d << "\taccum2u_rnd\t"
714+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel2u
715+
<< "\t" << error2u << std::endl;
717716

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

753-
std::cout << description << "\t" << n << "\t" << d << "\t"
754-
<< "accum3_rnd" << "\t" << nIterations << "\t" << timeFaiss
755-
<< "\t" << timeKernel3 << "\t" << error3 << std::endl;
752+
std::cout << description << "\t" << n << "\t" << d << "\taccum3_rnd\t"
753+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel3
754+
<< "\t" << error3 << std::endl;
756755

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

796-
std::cout << description << "\t" << n << "\t" << d << "\t"
797-
<< "accum3u_rnd" << "\t" << nIterations << "\t" << timeFaiss
798-
<< "\t" << timeKernel3u << "\t" << error3u << std::endl;
795+
std::cout << description << "\t" << n << "\t" << d << "\taccum3u_rnd\t"
796+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel3u
797+
<< "\t" << error3u << std::endl;
799798
}
800799
}
801800

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

854-
std::cout << description << "\t" << n << "\t" << d << "\t"
855-
<< "store_seq" << "\t" << nIterations << "\t" << timeFaiss
856-
<< "\t" << timeKernel << "\t" << error << std::endl;
853+
std::cout << description << "\t" << n << "\t" << d << "\tstore_seq\t"
854+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel
855+
<< "\t" << error << std::endl;
857856
}
858857

859858
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -899,9 +898,9 @@ static void verifyIndexPQDecoder(
899898
// evaluate the error
900899
const double error = getError(n, d, outputFaiss, outputKernel1);
901900

902-
std::cout << description << "\t" << n << "\t" << d << "\t"
903-
<< "store_rnd" << "\t" << nIterations << "\t" << timeFaiss
904-
<< "\t" << timeKernel << "\t" << error << std::endl;
901+
std::cout << description << "\t" << n << "\t" << d << "\tstore_rnd\t"
902+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel
903+
<< "\t" << error << std::endl;
905904
}
906905

907906
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -961,9 +960,9 @@ static void verifyIndexPQDecoder(
961960
// evaluate the error
962961
const double error1 = getError(n, d, outputFaiss, outputKernel1);
963962

964-
std::cout << description << "\t" << n << "\t" << d << "\t"
965-
<< "accum_rnd" << "\t" << nIterations << "\t" << timeFaiss
966-
<< "\t" << timeKernel1 << "\t" << error1 << std::endl;
963+
std::cout << description << "\t" << n << "\t" << d << "\taccum_rnd\t"
964+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel1
965+
<< "\t" << error1 << std::endl;
967966

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

992-
std::cout << description << "\t" << n << "\t" << d << "\t"
993-
<< "accum2_rnd" << "\t" << nIterations << "\t" << timeFaiss
994-
<< "\t" << timeKernel2 << "\t" << error2 << std::endl;
991+
std::cout << description << "\t" << n << "\t" << d << "\taccum2_rnd\t"
992+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel2
993+
<< "\t" << error2 << std::endl;
995994

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

1021-
std::cout << description << "\t" << n << "\t" << d << "\t"
1022-
<< "accum2u_rnd" << "\t" << nIterations << "\t" << timeFaiss
1023-
<< "\t" << timeKernel2u << "\t" << error2u << std::endl;
1020+
std::cout << description << "\t" << n << "\t" << d << "\taccum2u_rnd\t"
1021+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel2u
1022+
<< "\t" << error2u << std::endl;
10241023

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

1054-
std::cout << description << "\t" << n << "\t" << d << "\t"
1055-
<< "accum3_rnd" << "\t" << nIterations << "\t" << timeFaiss
1056-
<< "\t" << timeKernel3 << "\t" << error3 << std::endl;
1053+
std::cout << description << "\t" << n << "\t" << d << "\taccum3_rnd\t"
1054+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel3
1055+
<< "\t" << error3 << std::endl;
10571056

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

1089-
std::cout << description << "\t" << n << "\t" << d << "\t"
1090-
<< "accum3u_rnd" << "\t" << nIterations << "\t" << timeFaiss
1091-
<< "\t" << timeKernel3u << "\t" << error3u << std::endl;
1088+
std::cout << description << "\t" << n << "\t" << d << "\taccum3u_rnd\t"
1089+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel3u
1090+
<< "\t" << error3u << std::endl;
10921091
}
10931092
}
10941093

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

1152-
std::cout << description << "\t" << n << "\t" << d << "\t"
1153-
<< "store_seq" << "\t" << nIterations << "\t" << timeFaiss
1154-
<< "\t" << timeKernel << "\t" << error << std::endl;
1151+
std::cout << description << "\t" << n << "\t" << d << "\tstore_seq\t"
1152+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel
1153+
<< "\t" << error << std::endl;
11551154
}
11561155

11571156
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1197,9 +1196,9 @@ static void verifyMinMaxIndexPQDecoder(
11971196
// evaluate the error
11981197
const double error = getError(n, d, outputFaiss, outputKernel1);
11991198

1200-
std::cout << description << "\t" << n << "\t" << d << "\t"
1201-
<< "store_rnd" << "\t" << nIterations << "\t" << timeFaiss
1202-
<< "\t" << timeKernel << "\t" << error << std::endl;
1199+
std::cout << description << "\t" << n << "\t" << d << "\tstore_rnd\t"
1200+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel
1201+
<< "\t" << error << std::endl;
12031202
}
12041203

12051204
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1264,9 +1263,9 @@ static void verifyMinMaxIndexPQDecoder(
12641263
// evaluate the error
12651264
const double error1 = getError(n, d, outputFaiss, outputKernel1);
12661265

1267-
std::cout << description << "\t" << n << "\t" << d << "\t"
1268-
<< "accum_rnd" << "\t" << nIterations << "\t" << timeFaiss
1269-
<< "\t" << timeKernel1 << "\t" << error1 << std::endl;
1266+
std::cout << description << "\t" << n << "\t" << d << "\taccum_rnd\t"
1267+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel1
1268+
<< "\t" << error1 << std::endl;
12701269

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

1300-
std::cout << description << "\t" << n << "\t" << d << "\t"
1301-
<< "accum2_rnd" << "\t" << nIterations << "\t" << timeFaiss
1302-
<< "\t" << timeKernel2 << "\t" << error2 << std::endl;
1299+
std::cout << description << "\t" << n << "\t" << d << "\taccum2_rnd\t"
1300+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel2
1301+
<< "\t" << error2 << std::endl;
13031302

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

1334-
std::cout << description << "\t" << n << "\t" << d << "\t"
1335-
<< "accum2u_rnd" << "\t" << nIterations << "\t" << timeFaiss
1336-
<< "\t" << timeKernel2u << "\t" << error2u << std::endl;
1333+
std::cout << description << "\t" << n << "\t" << d << "\taccum2u_rnd\t"
1334+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel2u
1335+
<< "\t" << error2u << std::endl;
13371336

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

1372-
std::cout << description << "\t" << n << "\t" << d << "\t"
1373-
<< "accum3_rnd" << "\t" << nIterations << "\t" << timeFaiss
1374-
<< "\t" << timeKernel3 << "\t" << error3 << std::endl;
1371+
std::cout << description << "\t" << n << "\t" << d << "\taccum3_rnd\t"
1372+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel3
1373+
<< "\t" << error3 << std::endl;
13751374

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

1412-
std::cout << description << "\t" << n << "\t" << d << "\t"
1413-
<< "accum3u_rnd" << "\t" << nIterations << "\t" << timeFaiss
1414-
<< "\t" << timeKernel3u << "\t" << error3u << std::endl;
1411+
std::cout << description << "\t" << n << "\t" << d << "\taccum3u_rnd\t"
1412+
<< nIterations << "\t" << timeFaiss << "\t" << timeKernel3u
1413+
<< "\t" << error3u << std::endl;
14151414
}
14161415
}
14171416

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

14861485
// print the header
1487-
std::cout << "Codec\t" << "n\t" << "d\t" << "Experiment\t" << "Iterations\t"
1488-
<< "Faiss time\t" << "SADecodeKernel time\t" << "Error"
1486+
auto delim = "\t";
1487+
std::cout << "Codec" << delim << "n" << delim << "d" << delim
1488+
<< "Experiment" << delim << "Iterations" << delim << "Faiss time"
1489+
<< delim << "SADecodeKernel time" << delim << "Error"
14891490
<< std::endl;
14901491

14911492
// The following experiment types are available:

0 commit comments

Comments
 (0)