Skip to content

Commit 6877a1b

Browse files
committed
All C API enums are now given explicit values
1 parent 9f5b25f commit 6877a1b

File tree

8 files changed

+32
-32
lines changed

8 files changed

+32
-32
lines changed

cpp/include/cuvs/c/cluster/kmeans.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ typedef enum {
3434
/**
3535
* Sample the centroids using the kmeans++ strategy
3636
*/
37-
KMeansPlusPlus,
37+
KMeansPlusPlus = 0,
3838

3939
/**
4040
* Sample the centroids uniformly at random
4141
*/
42-
Random,
42+
Random = 1,
4343

4444
/**
4545
* User provides the array of initial centroids
4646
*/
47-
Array
47+
Array = 2
4848
} cuvsKMeansInitMethod;
4949

5050
/**

cpp/include/cuvs/c/core/c_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ extern "C" {
3333
* @brief An enum denoting error statuses for function calls
3434
*
3535
*/
36-
typedef enum { CUVS_ERROR, CUVS_SUCCESS } cuvsError_t;
36+
typedef enum { CUVS_ERROR = 0, CUVS_SUCCESS = 1 } cuvsError_t;
3737

3838
/** @brief Returns a string describing the last seen error on this thread, or
3939
* NULL if the last function succeeded.

cpp/include/cuvs/c/neighbors/cagra.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ extern "C" {
3939
*/
4040
enum cuvsCagraGraphBuildAlgo {
4141
/* Select build algorithm automatically */
42-
AUTO_SELECT,
42+
AUTO_SELECT = 0,
4343
/* Use IVF-PQ to build all-neighbors knn graph */
44-
IVF_PQ,
44+
IVF_PQ = 1,
4545
/* Experimental, use NN-Descent to build all-neighbors knn graph */
46-
NN_DESCENT,
46+
NN_DESCENT = 200,
4747
/* Experimental, use iterative cagra search and optimize to build the knn graph */
48-
ITERATIVE_CAGRA_SEARCH
48+
ITERATIVE_CAGRA_SEARCH = 300
4949
};
5050

5151
/** Parameters for VPQ compression. */
@@ -210,18 +210,18 @@ cuvsError_t cuvsCagraExtendParamsDestroy(cuvsCagraExtendParams_t params);
210210
*/
211211
enum cuvsCagraSearchAlgo {
212212
/** For large batch sizes. */
213-
SINGLE_CTA,
213+
SINGLE_CTA = 0,
214214
/** For small batch sizes. */
215-
MULTI_CTA,
216-
MULTI_KERNEL,
217-
AUTO
215+
MULTI_CTA = 1,
216+
MULTI_KERNEL = 2,
217+
AUTO = 100
218218
};
219219

220220
/**
221221
* @brief Enum to denote Hash Mode used while searching CAGRA index
222222
*
223223
*/
224-
enum cuvsCagraHashMode { HASH, SMALL, AUTO_HASH };
224+
enum cuvsCagraHashMode { HASH = 0, SMALL = 0, AUTO_HASH = 100 };
225225

226226
/**
227227
* @brief Supplemental parameters to search CAGRA index

cpp/include/cuvs/c/neighbors/common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ extern "C" {
3434
*/
3535
enum cuvsFilterType {
3636
/* No filter */
37-
NO_FILTER,
37+
NO_FILTER = 0,
3838
/* Filter an index with a bitset */
39-
BITSET,
39+
BITSET = 1,
4040
/* Filter an index with a bitmap */
41-
BITMAP
41+
BITMAP = 2
4242
};
4343

4444
/**

cpp/include/cuvs/c/neighbors/hnsw.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ extern "C" {
4040
*/
4141
enum cuvsHnswHierarchy {
4242
/* Flat hierarchy, search is base-layer only */
43-
NONE,
43+
NONE = 0,
4444
/* Full hierarchy is built using the CPU */
45-
CPU,
45+
CPU = 1,
4646
/* Full hierarchy is built using the GPU */
47-
GPU
47+
GPU = 2
4848
};
4949

5050
struct cuvsHnswIndexParams {

cpp/include/cuvs/c/neighbors/mg_common.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,29 @@ extern "C" {
3333
*/
3434
typedef enum {
3535
/** Index is replicated on each device, favors throughput */
36-
CUVS_NEIGHBORS_MG_REPLICATED,
36+
CUVS_NEIGHBORS_MG_REPLICATED = 0,
3737
/** Index is split on several devices, favors scaling */
38-
CUVS_NEIGHBORS_MG_SHARDED
38+
CUVS_NEIGHBORS_MG_SHARDED = 1
3939
} cuvsMultiGpuDistributionMode;
4040

4141
/**
4242
* @brief Search mode when using a replicated index
4343
*/
4444
typedef enum {
4545
/** Search queries are split to maintain equal load on GPUs */
46-
CUVS_NEIGHBORS_MG_LOAD_BALANCER,
46+
CUVS_NEIGHBORS_MG_LOAD_BALANCER = 0,
4747
/** Each search query is processed by a single GPU in a round-robin fashion */
48-
CUVS_NEIGHBORS_MG_ROUND_ROBIN
48+
CUVS_NEIGHBORS_MG_ROUND_ROBIN = 1
4949
} cuvsMultiGpuReplicatedSearchMode;
5050

5151
/**
5252
* @brief Merge mode when using a sharded index
5353
*/
5454
typedef enum {
5555
/** Search batches are merged on the root rank */
56-
CUVS_NEIGHBORS_MG_MERGE_ON_ROOT_RANK,
56+
CUVS_NEIGHBORS_MG_MERGE_ON_ROOT_RANK = 0,
5757
/** Search batches are merged in a tree reduction fashion */
58-
CUVS_NEIGHBORS_MG_TREE_MERGE
58+
CUVS_NEIGHBORS_MG_TREE_MERGE = 1
5959
} cuvsMultiGpuShardedMergeMode;
6060

6161
/**

cpp/include/cuvs/c/neighbors/tiered_index.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ extern "C" {
3333
* @brief Enum to hold which ANN algorithm is being used in the tiered index
3434
*/
3535
typedef enum {
36-
CUVS_TIERED_INDEX_ALGO_CAGRA,
37-
CUVS_TIERED_INDEX_ALGO_IVF_FLAT,
38-
CUVS_TIERED_INDEX_ALGO_IVF_PQ
36+
CUVS_TIERED_INDEX_ALGO_CAGRA = 0,
37+
CUVS_TIERED_INDEX_ALGO_IVF_FLAT = 1,
38+
CUVS_TIERED_INDEX_ALGO_IVF_PQ = 2
3939
} cuvsTieredIndexANNAlgo;
4040

4141
/**

cpp/include/cuvs/neighbors/cagra.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ struct index_params : cuvs::neighbors::index_params {
129129

130130
enum class search_algo {
131131
/** For large batch sizes. */
132-
SINGLE_CTA,
132+
SINGLE_CTA = 0,
133133
/** For small batch sizes. */
134-
MULTI_CTA,
135-
MULTI_KERNEL,
136-
AUTO
134+
MULTI_CTA = 1,
135+
MULTI_KERNEL = 2,
136+
AUTO = 100
137137
};
138138

139139
enum class hash_mode { HASH, SMALL, AUTO };

0 commit comments

Comments
 (0)