|
1 | 1 | /* |
2 | | - * Copyright (c) 2024, NVIDIA CORPORATION. |
| 2 | + * Copyright (c) 2024-2025, NVIDIA CORPORATION. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
16 | 16 |
|
17 | 17 | #include <cuvs/core/c_api.h> |
18 | 18 | #include <cuvs/neighbors/cagra.h> |
| 19 | +#include <cuvs/neighbors/tiered_index.h> |
| 20 | + |
| 21 | +#include <dlpack/dlpack.h> |
| 22 | + |
| 23 | +#include <assert.h> |
19 | 24 | #include <stdio.h> |
20 | 25 | #include <stdlib.h> |
21 | 26 |
|
22 | | -int main() |
| 27 | +void test_compile_cagra() |
23 | 28 | { |
24 | 29 | // simple smoke test to make sure that we can compile the cagra.h API |
25 | 30 | // using a c compiler. This isn't aiming to be a full test, just checking |
26 | 31 | // that the exposed C-API is valid C code and doesn't contain C++ features |
| 32 | + assert(!"test_compile_cagra is not meant to be run"); |
| 33 | + |
27 | 34 | cuvsCagraIndex_t index; |
28 | 35 | cuvsCagraIndexCreate(&index); |
29 | 36 | cuvsCagraIndexDestroy(index); |
| 37 | +} |
| 38 | + |
| 39 | +void test_compile_tiered_index() |
| 40 | +{ |
| 41 | + // Smoke test to ensure that the tiered_index.h API compiles correctly |
| 42 | + // using a c compiler. Not a full test. |
| 43 | + assert(!"test_compile_tiered_index is not meant to be run"); |
| 44 | + |
| 45 | + cuvsTieredIndex_t tiered_index; |
| 46 | + cuvsTieredIndexCreate(&tiered_index); |
| 47 | + cuvsTieredIndexDestroy(tiered_index); |
| 48 | + |
| 49 | + cuvsTieredIndexParams_t index_params; |
| 50 | + cuvsResources_t resources; |
| 51 | + cuvsFilter prefilter; |
| 52 | + DLManagedTensor dataset, neighbors, distances; |
| 53 | + cuvsTieredIndexParamsCreate(&index_params); |
| 54 | + cuvsTieredIndexParamsDestroy(index_params); |
| 55 | + cuvsTieredIndexBuild(resources, index_params, &dataset, tiered_index); |
| 56 | + cuvsTieredIndexSearch(resources, NULL, tiered_index, &dataset, &neighbors, &distances, prefilter); |
| 57 | + cuvsTieredIndexExtend(resources, &dataset, tiered_index); |
| 58 | +} |
| 59 | + |
| 60 | +int main() |
| 61 | +{ |
| 62 | + // These are smoke tests that check that the C-APIs compile with a C compiler. |
| 63 | + // These are not meant to be run. |
| 64 | + test_compile_cagra(); |
| 65 | + test_compile_tiered_index(); |
| 66 | + |
30 | 67 | return 0; |
31 | 68 | } |
0 commit comments