12 #include "../../FaissAssert.h"
13 #include "../../Index.h"
14 #include <initializer_list>
19 namespace faiss {
namespace gpu {
25 void setTestSeed(
long seed);
29 float relativeError(
float a,
float b);
32 int randVal(
int a,
int b);
40 T randSelect(std::initializer_list<T> vals) {
41 FAISS_ASSERT(vals.size() > 0);
42 int sel = randVal(0, vals.size());
56 std::vector<float> randVecs(
size_t num,
size_t dim);
59 std::vector<unsigned char> randBinaryVecs(
size_t num,
size_t dim);
63 void compareIndices(
const std::vector<float>& queryVecs,
66 int numQuery,
int dim,
int k,
67 const std::string& configMsg,
68 float maxRelativeError = 6e-5f,
69 float pctMaxDiff1 = 0.1f,
70 float pctMaxDiffN = 0.005f);
76 int numQuery,
int dim,
int k,
77 const std::string& configMsg,
78 float maxRelativeError = 6e-5f,
79 float pctMaxDiff1 = 0.1f,
80 float pctMaxDiffN = 0.005f);
83 void compareLists(
const float* refDist,
85 const float* testDist,
88 const std::string& configMsg,
89 bool printBasicStats,
bool printDiffs,
bool assertOnErr,
90 float maxRelativeError = 6e-5f,
91 float pctMaxDiff1 = 0.1f,
92 float pctMaxDiffN = 0.005f);
long idx_t
all indices are this type