Skip to content

Commit 5b608e9

Browse files
zertoshfacebook-github-bot
authored andcommitted
Apply clang-format 18
Summary: Previously this code conformed from clang-format 12. Reviewed By: igorsugak Differential Revision: D56065247 fbshipit-source-id: f5a985dd8f8b84f2f9e1818b3719b43c5a1b05b3
1 parent 2ade9b3 commit 5b608e9

5 files changed

Lines changed: 67 additions & 101 deletions

File tree

benchs/bench_cppcontrib_sa_decode.cpp

Lines changed: 59 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,8 @@ static void verifyIndex2LevelDecoder(
214214
double error = getError(n, d, outputFaiss, outputKernel1);
215215

216216
std::cout << description << "\t" << n << "\t" << d << "\t"
217-
<< "store_seq"
218-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
219-
<< timeKernel << "\t" << error << std::endl;
217+
<< "store_seq" << "\t" << nIterations << "\t" << timeFaiss
218+
<< "\t" << timeKernel << "\t" << error << std::endl;
220219
}
221220

222221
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -264,9 +263,8 @@ static void verifyIndex2LevelDecoder(
264263
const double error = getError(n, d, outputFaiss, outputKernel1);
265264

266265
std::cout << description << "\t" << n << "\t" << d << "\t"
267-
<< "store_rnd"
268-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
269-
<< timeKernel << "\t" << error << std::endl;
266+
<< "store_rnd" << "\t" << nIterations << "\t" << timeFaiss
267+
<< "\t" << timeKernel << "\t" << error << std::endl;
270268
}
271269

272270
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -327,9 +325,8 @@ static void verifyIndex2LevelDecoder(
327325
const double error1 = getError(n, d, outputFaiss, outputKernel1);
328326

329327
std::cout << description << "\t" << n << "\t" << d << "\t"
330-
<< "accum_rnd"
331-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
332-
<< timeKernel1 << "\t" << error1 << std::endl;
328+
<< "accum_rnd" << "\t" << nIterations << "\t" << timeFaiss
329+
<< "\t" << timeKernel1 << "\t" << error1 << std::endl;
333330

334331
// kernels: accum 2 points, shared centroids
335332
StopWatch swKernel2;
@@ -357,9 +354,8 @@ static void verifyIndex2LevelDecoder(
357354
const double error2 = getError(n, d, outputFaiss, outputKernel2);
358355

359356
std::cout << description << "\t" << n << "\t" << d << "\t"
360-
<< "accum2_rnd"
361-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
362-
<< timeKernel2 << "\t" << error2 << std::endl;
357+
<< "accum2_rnd" << "\t" << nIterations << "\t" << timeFaiss
358+
<< "\t" << timeKernel2 << "\t" << error2 << std::endl;
363359

364360
// kernels: accum 2 points, unique centroids
365361
StopWatch swKernel2u;
@@ -389,9 +385,8 @@ static void verifyIndex2LevelDecoder(
389385
const double error2u = getError(n, d, outputFaiss, outputKernel2u);
390386

391387
std::cout << description << "\t" << n << "\t" << d << "\t"
392-
<< "accum2u_rnd"
393-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
394-
<< timeKernel2u << "\t" << error2u << std::endl;
388+
<< "accum2u_rnd" << "\t" << nIterations << "\t" << timeFaiss
389+
<< "\t" << timeKernel2u << "\t" << error2u << std::endl;
395390

396391
// kernels: accum 3 points, shared centroids
397392
StopWatch swKernel3;
@@ -424,9 +419,8 @@ static void verifyIndex2LevelDecoder(
424419
const double error3 = getError(n, d, outputFaiss, outputKernel3);
425420

426421
std::cout << description << "\t" << n << "\t" << d << "\t"
427-
<< "accum3_rnd"
428-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
429-
<< timeKernel3 << "\t" << error3 << std::endl;
422+
<< "accum3_rnd" << "\t" << nIterations << "\t" << timeFaiss
423+
<< "\t" << timeKernel3 << "\t" << error3 << std::endl;
430424

431425
// kernels: accum 3 points, unique centroids
432426
StopWatch swKernel3u;
@@ -463,9 +457,8 @@ static void verifyIndex2LevelDecoder(
463457
const double error3u = getError(n, d, outputFaiss, outputKernel3u);
464458

465459
std::cout << description << "\t" << n << "\t" << d << "\t"
466-
<< "accum3u_rnd"
467-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
468-
<< timeKernel3u << "\t" << error3u << std::endl;
460+
<< "accum3u_rnd" << "\t" << nIterations << "\t" << timeFaiss
461+
<< "\t" << timeKernel3u << "\t" << error3u << std::endl;
469462
}
470463
}
471464

@@ -532,9 +525,8 @@ static void verifyMinMaxIndex2LevelDecoder(
532525
double error = getError(n, d, outputFaiss, outputKernel1);
533526

534527
std::cout << description << "\t" << n << "\t" << d << "\t"
535-
<< "store_seq"
536-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
537-
<< timeKernel << "\t" << error << std::endl;
528+
<< "store_seq" << "\t" << nIterations << "\t" << timeFaiss
529+
<< "\t" << timeKernel << "\t" << error << std::endl;
538530
}
539531

540532
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -582,9 +574,8 @@ static void verifyMinMaxIndex2LevelDecoder(
582574
const double error = getError(n, d, outputFaiss, outputKernel1);
583575

584576
std::cout << description << "\t" << n << "\t" << d << "\t"
585-
<< "store_rnd"
586-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
587-
<< timeKernel << "\t" << error << std::endl;
577+
<< "store_rnd" << "\t" << nIterations << "\t" << timeFaiss
578+
<< "\t" << timeKernel << "\t" << error << std::endl;
588579
}
589580

590581
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -651,9 +642,8 @@ static void verifyMinMaxIndex2LevelDecoder(
651642
const double error1 = getError(n, d, outputFaiss, outputKernel1);
652643

653644
std::cout << description << "\t" << n << "\t" << d << "\t"
654-
<< "accum_rnd"
655-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
656-
<< timeKernel1 << "\t" << error1 << std::endl;
645+
<< "accum_rnd" << "\t" << nIterations << "\t" << timeFaiss
646+
<< "\t" << timeKernel1 << "\t" << error1 << std::endl;
657647

658648
// kernels: accum 2 points, shared centroids
659649
StopWatch swKernel2;
@@ -686,9 +676,8 @@ static void verifyMinMaxIndex2LevelDecoder(
686676
const double error2 = getError(n, d, outputFaiss, outputKernel2);
687677

688678
std::cout << description << "\t" << n << "\t" << d << "\t"
689-
<< "accum2_rnd"
690-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
691-
<< timeKernel2 << "\t" << error2 << std::endl;
679+
<< "accum2_rnd" << "\t" << nIterations << "\t" << timeFaiss
680+
<< "\t" << timeKernel2 << "\t" << error2 << std::endl;
692681

693682
// kernels: accum 2 points, unique centroids
694683
StopWatch swKernel2u;
@@ -723,9 +712,8 @@ static void verifyMinMaxIndex2LevelDecoder(
723712
const double error2u = getError(n, d, outputFaiss, outputKernel2u);
724713

725714
std::cout << description << "\t" << n << "\t" << d << "\t"
726-
<< "accum2u_rnd"
727-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
728-
<< timeKernel2u << "\t" << error2u << std::endl;
715+
<< "accum2u_rnd" << "\t" << nIterations << "\t" << timeFaiss
716+
<< "\t" << timeKernel2u << "\t" << error2u << std::endl;
729717

730718
// kernels: accum 3 points, shared centroids
731719
StopWatch swKernel3;
@@ -763,9 +751,8 @@ static void verifyMinMaxIndex2LevelDecoder(
763751
const double error3 = getError(n, d, outputFaiss, outputKernel3);
764752

765753
std::cout << description << "\t" << n << "\t" << d << "\t"
766-
<< "accum3_rnd"
767-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
768-
<< timeKernel3 << "\t" << error3 << std::endl;
754+
<< "accum3_rnd" << "\t" << nIterations << "\t" << timeFaiss
755+
<< "\t" << timeKernel3 << "\t" << error3 << std::endl;
769756

770757
// kernels: accum 3 points, unique centroids
771758
StopWatch swKernel3u;
@@ -807,9 +794,8 @@ static void verifyMinMaxIndex2LevelDecoder(
807794
const double error3u = getError(n, d, outputFaiss, outputKernel3u);
808795

809796
std::cout << description << "\t" << n << "\t" << d << "\t"
810-
<< "accum3u_rnd"
811-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
812-
<< timeKernel3u << "\t" << error3u << std::endl;
797+
<< "accum3u_rnd" << "\t" << nIterations << "\t" << timeFaiss
798+
<< "\t" << timeKernel3u << "\t" << error3u << std::endl;
813799
}
814800
}
815801

@@ -866,9 +852,8 @@ static void verifyIndexPQDecoder(
866852
double error = getError(n, d, outputFaiss, outputKernel1);
867853

868854
std::cout << description << "\t" << n << "\t" << d << "\t"
869-
<< "store_seq"
870-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
871-
<< timeKernel << "\t" << error << std::endl;
855+
<< "store_seq" << "\t" << nIterations << "\t" << timeFaiss
856+
<< "\t" << timeKernel << "\t" << error << std::endl;
872857
}
873858

874859
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -915,9 +900,8 @@ static void verifyIndexPQDecoder(
915900
const double error = getError(n, d, outputFaiss, outputKernel1);
916901

917902
std::cout << description << "\t" << n << "\t" << d << "\t"
918-
<< "store_rnd"
919-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
920-
<< timeKernel << "\t" << error << std::endl;
903+
<< "store_rnd" << "\t" << nIterations << "\t" << timeFaiss
904+
<< "\t" << timeKernel << "\t" << error << std::endl;
921905
}
922906

923907
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -978,9 +962,8 @@ static void verifyIndexPQDecoder(
978962
const double error1 = getError(n, d, outputFaiss, outputKernel1);
979963

980964
std::cout << description << "\t" << n << "\t" << d << "\t"
981-
<< "accum_rnd"
982-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
983-
<< timeKernel1 << "\t" << error1 << std::endl;
965+
<< "accum_rnd" << "\t" << nIterations << "\t" << timeFaiss
966+
<< "\t" << timeKernel1 << "\t" << error1 << std::endl;
984967

985968
// kernels: accum 2 points, shared centroids
986969
StopWatch swKernel2;
@@ -1007,9 +990,8 @@ static void verifyIndexPQDecoder(
1007990
const double error2 = getError(n, d, outputFaiss, outputKernel2);
1008991

1009992
std::cout << description << "\t" << n << "\t" << d << "\t"
1010-
<< "accum2_rnd"
1011-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
1012-
<< timeKernel2 << "\t" << error2 << std::endl;
993+
<< "accum2_rnd" << "\t" << nIterations << "\t" << timeFaiss
994+
<< "\t" << timeKernel2 << "\t" << error2 << std::endl;
1013995

1014996
// kernels: accum 2 points, unique centroids
1015997
StopWatch swKernel2u;
@@ -1037,9 +1019,8 @@ static void verifyIndexPQDecoder(
10371019
const double error2u = getError(n, d, outputFaiss, outputKernel2u);
10381020

10391021
std::cout << description << "\t" << n << "\t" << d << "\t"
1040-
<< "accum2u_rnd"
1041-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
1042-
<< timeKernel2u << "\t" << error2u << std::endl;
1022+
<< "accum2u_rnd" << "\t" << nIterations << "\t" << timeFaiss
1023+
<< "\t" << timeKernel2u << "\t" << error2u << std::endl;
10431024

10441025
// kernels: accum 3 points, shared centroids
10451026
StopWatch swKernel3;
@@ -1071,9 +1052,8 @@ static void verifyIndexPQDecoder(
10711052
const double error3 = getError(n, d, outputFaiss, outputKernel3);
10721053

10731054
std::cout << description << "\t" << n << "\t" << d << "\t"
1074-
<< "accum3_rnd"
1075-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
1076-
<< timeKernel3 << "\t" << error3 << std::endl;
1055+
<< "accum3_rnd" << "\t" << nIterations << "\t" << timeFaiss
1056+
<< "\t" << timeKernel3 << "\t" << error3 << std::endl;
10771057

10781058
// kernels: accum 3 points, unique centroids
10791059
StopWatch swKernel3u;
@@ -1107,9 +1087,8 @@ static void verifyIndexPQDecoder(
11071087
const double error3u = getError(n, d, outputFaiss, outputKernel3u);
11081088

11091089
std::cout << description << "\t" << n << "\t" << d << "\t"
1110-
<< "accum3u_rnd"
1111-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
1112-
<< timeKernel3u << "\t" << error3u << std::endl;
1090+
<< "accum3u_rnd" << "\t" << nIterations << "\t" << timeFaiss
1091+
<< "\t" << timeKernel3u << "\t" << error3u << std::endl;
11131092
}
11141093
}
11151094

@@ -1171,9 +1150,8 @@ static void verifyMinMaxIndexPQDecoder(
11711150
double error = getError(n, d, outputFaiss, outputKernel1);
11721151

11731152
std::cout << description << "\t" << n << "\t" << d << "\t"
1174-
<< "store_seq"
1175-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
1176-
<< timeKernel << "\t" << error << std::endl;
1153+
<< "store_seq" << "\t" << nIterations << "\t" << timeFaiss
1154+
<< "\t" << timeKernel << "\t" << error << std::endl;
11771155
}
11781156

11791157
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1220,9 +1198,8 @@ static void verifyMinMaxIndexPQDecoder(
12201198
const double error = getError(n, d, outputFaiss, outputKernel1);
12211199

12221200
std::cout << description << "\t" << n << "\t" << d << "\t"
1223-
<< "store_rnd"
1224-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
1225-
<< timeKernel << "\t" << error << std::endl;
1201+
<< "store_rnd" << "\t" << nIterations << "\t" << timeFaiss
1202+
<< "\t" << timeKernel << "\t" << error << std::endl;
12261203
}
12271204

12281205
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1288,9 +1265,8 @@ static void verifyMinMaxIndexPQDecoder(
12881265
const double error1 = getError(n, d, outputFaiss, outputKernel1);
12891266

12901267
std::cout << description << "\t" << n << "\t" << d << "\t"
1291-
<< "accum_rnd"
1292-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
1293-
<< timeKernel1 << "\t" << error1 << std::endl;
1268+
<< "accum_rnd" << "\t" << nIterations << "\t" << timeFaiss
1269+
<< "\t" << timeKernel1 << "\t" << error1 << std::endl;
12941270

12951271
// kernels: accum 2 points, shared centroids
12961272
StopWatch swKernel2;
@@ -1322,9 +1298,8 @@ static void verifyMinMaxIndexPQDecoder(
13221298
const double error2 = getError(n, d, outputFaiss, outputKernel2);
13231299

13241300
std::cout << description << "\t" << n << "\t" << d << "\t"
1325-
<< "accum2_rnd"
1326-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
1327-
<< timeKernel2 << "\t" << error2 << std::endl;
1301+
<< "accum2_rnd" << "\t" << nIterations << "\t" << timeFaiss
1302+
<< "\t" << timeKernel2 << "\t" << error2 << std::endl;
13281303

13291304
// kernels: accum 2 points, unique centroids
13301305
StopWatch swKernel2u;
@@ -1357,9 +1332,8 @@ static void verifyMinMaxIndexPQDecoder(
13571332
const double error2u = getError(n, d, outputFaiss, outputKernel2u);
13581333

13591334
std::cout << description << "\t" << n << "\t" << d << "\t"
1360-
<< "accum2u_rnd"
1361-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
1362-
<< timeKernel2u << "\t" << error2u << std::endl;
1335+
<< "accum2u_rnd" << "\t" << nIterations << "\t" << timeFaiss
1336+
<< "\t" << timeKernel2u << "\t" << error2u << std::endl;
13631337

13641338
// kernels: accum 3 points, shared centroids
13651339
StopWatch swKernel3;
@@ -1396,9 +1370,8 @@ static void verifyMinMaxIndexPQDecoder(
13961370
const double error3 = getError(n, d, outputFaiss, outputKernel3);
13971371

13981372
std::cout << description << "\t" << n << "\t" << d << "\t"
1399-
<< "accum3_rnd"
1400-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
1401-
<< timeKernel3 << "\t" << error3 << std::endl;
1373+
<< "accum3_rnd" << "\t" << nIterations << "\t" << timeFaiss
1374+
<< "\t" << timeKernel3 << "\t" << error3 << std::endl;
14021375

14031376
// kernels: accum 3 points, unique centroids
14041377
StopWatch swKernel3u;
@@ -1437,9 +1410,8 @@ static void verifyMinMaxIndexPQDecoder(
14371410
const double error3u = getError(n, d, outputFaiss, outputKernel3u);
14381411

14391412
std::cout << description << "\t" << n << "\t" << d << "\t"
1440-
<< "accum3u_rnd"
1441-
<< "\t" << nIterations << "\t" << timeFaiss << "\t"
1442-
<< timeKernel3u << "\t" << error3u << std::endl;
1413+
<< "accum3u_rnd" << "\t" << nIterations << "\t" << timeFaiss
1414+
<< "\t" << timeKernel3u << "\t" << error3u << std::endl;
14431415
}
14441416
}
14451417

@@ -1512,14 +1484,9 @@ int main(int argc, char** argv) {
15121484
(N_ITERATIONS % 6) == 0, "Number of iterations should be 6*x");
15131485

15141486
// print the header
1515-
std::cout << "Codec\t"
1516-
<< "n\t"
1517-
<< "d\t"
1518-
<< "Experiment\t"
1519-
<< "Iterations\t"
1520-
<< "Faiss time\t"
1521-
<< "SADecodeKernel time\t"
1522-
<< "Error" << std::endl;
1487+
std::cout << "Codec\t" << "n\t" << "d\t" << "Experiment\t" << "Iterations\t"
1488+
<< "Faiss time\t" << "SADecodeKernel time\t" << "Error"
1489+
<< std::endl;
15231490

15241491
// The following experiment types are available:
15251492
// * store_seq - decode a contiguous block of codes into vectors, one by one

faiss/IndexBinaryIVF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ void search_knn_hamming_heap(
456456
}
457457

458458
} // parallel for
459-
} // parallel
459+
} // parallel
460460

461461
indexIVF_stats.nq += n;
462462
indexIVF_stats.nlist += nlistv;

faiss/gpu/utils/Tensor.cuh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,12 @@ class Tensor {
232232
}
233233

234234
/// Returns a read/write view of a portion of our tensor.
235-
__host__ __device__ inline detail::SubTensor<TensorType, Dim - 1, PtrTraits>
236-
operator[](IndexT);
235+
__host__ __device__ inline detail::
236+
SubTensor<TensorType, Dim - 1, PtrTraits> operator[](IndexT);
237237

238238
/// Returns a read/write view of a portion of our tensor (const).
239239
__host__ __device__ inline const detail::
240-
SubTensor<TensorType, Dim - 1, PtrTraits>
241-
operator[](IndexT) const;
240+
SubTensor<TensorType, Dim - 1, PtrTraits> operator[](IndexT) const;
242241

243242
/// Returns the size of a given dimension, `[0, Dim - 1]`. No bounds
244243
/// checking.

faiss/impl/HNSW.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ void HNSW::print_neighbor_stats(int level) const {
110110
level,
111111
nb_neighbors(level));
112112
size_t tot_neigh = 0, tot_common = 0, tot_reciprocal = 0, n_node = 0;
113-
#pragma omp parallel for reduction(+: tot_neigh) reduction(+: tot_common) \
114-
reduction(+: tot_reciprocal) reduction(+: n_node)
113+
#pragma omp parallel for reduction(+ : tot_neigh) reduction(+ : tot_common) \
114+
reduction(+ : tot_reciprocal) reduction(+ : n_node)
115115
for (int i = 0; i < levels.size(); i++) {
116116
if (levels[i] > level) {
117117
n_node++;

0 commit comments

Comments
 (0)