11/*
2- * SPDX-FileCopyrightText: Copyright (c) 2024-2025 , NVIDIA CORPORATION.
2+ * SPDX-FileCopyrightText: Copyright (c) 2024-2026 , NVIDIA CORPORATION.
33 * SPDX-License-Identifier: Apache-2.0
44 */
55
1010#include <stdbool.h>
1111#include <stdint.h>
1212
13+ #include <cuvs/core/export.h>
14+
1315#ifdef __cplusplus
1416extern "C" {
1517#endif
@@ -27,13 +29,13 @@ typedef enum { CUVS_ERROR = 0, CUVS_SUCCESS = 1 } cuvsError_t;
2729/** @brief Returns a string describing the last seen error on this thread, or
2830 * NULL if the last function succeeded.
2931 */
30- const char * cuvsGetLastErrorText ();
32+ CUVS_EXPORT const char * cuvsGetLastErrorText ();
3133
3234/**
3335 * @brief Sets a string describing an error seen on the thread. Passing NULL
3436 * clears any previously seen error message.
3537 */
36- void cuvsSetLastErrorText (const char * error );
38+ CUVS_EXPORT void cuvsSetLastErrorText (const char * error );
3739
3840/** @} */
3941
@@ -58,11 +60,11 @@ typedef enum {
5860
5961/** @brief Returns the current log level
6062 */
61- cuvsLogLevel_t cuvsGetLogLevel ();
63+ CUVS_EXPORT cuvsLogLevel_t cuvsGetLogLevel ();
6264
6365/** @brief Sets the log level
6466 */
65- void cuvsSetLogLevel (cuvsLogLevel_t );
67+ CUVS_EXPORT void cuvsSetLogLevel (cuvsLogLevel_t );
6668
6769/** @} */
6870
@@ -83,15 +85,15 @@ typedef uintptr_t cuvsResources_t;
8385 * @param[in] res cuvsResources_t opaque C handle
8486 * @return cuvsError_t
8587 */
86- cuvsError_t cuvsResourcesCreate (cuvsResources_t * res );
88+ CUVS_EXPORT cuvsError_t cuvsResourcesCreate (cuvsResources_t * res );
8789
8890/**
8991 * @brief Destroy and de-allocate opaque C handle for C++ type `raft::resources`
9092 *
9193 * @param[in] res cuvsResources_t opaque C handle
9294 * @return cuvsError_t
9395 */
94- cuvsError_t cuvsResourcesDestroy (cuvsResources_t res );
96+ CUVS_EXPORT cuvsError_t cuvsResourcesDestroy (cuvsResources_t res );
9597
9698/**
9799 * @brief Set cudaStream_t on cuvsResources_t to queue CUDA kernels on APIs
@@ -101,7 +103,7 @@ cuvsError_t cuvsResourcesDestroy(cuvsResources_t res);
101103 * @param[in] stream cudaStream_t stream to queue CUDA kernels
102104 * @return cuvsError_t
103105 */
104- cuvsError_t cuvsStreamSet (cuvsResources_t res , cudaStream_t stream );
106+ CUVS_EXPORT cuvsError_t cuvsStreamSet (cuvsResources_t res , cudaStream_t stream );
105107
106108/**
107109 * @brief Get the cudaStream_t from a cuvsResources_t
@@ -110,15 +112,15 @@ cuvsError_t cuvsStreamSet(cuvsResources_t res, cudaStream_t stream);
110112 * @param[out] stream cudaStream_t stream to queue CUDA kernels
111113 * @return cuvsError_t
112114 */
113- cuvsError_t cuvsStreamGet (cuvsResources_t res , cudaStream_t * stream );
115+ CUVS_EXPORT cuvsError_t cuvsStreamGet (cuvsResources_t res , cudaStream_t * stream );
114116
115117/**
116118 * @brief Syncs the current CUDA stream on the resources object
117119 *
118120 * @param[in] res cuvsResources_t opaque C handle
119121 * @return cuvsError_t
120122 */
121- cuvsError_t cuvsStreamSync (cuvsResources_t res );
123+ CUVS_EXPORT cuvsError_t cuvsStreamSync (cuvsResources_t res );
122124
123125/**
124126 * @brief Get the id of the device associated with this cuvsResources_t
@@ -127,7 +129,7 @@ cuvsError_t cuvsStreamSync(cuvsResources_t res);
127129 * @param[out] device_id int the id of the device associated with res
128130 * @return cuvsError_t
129131 */
130- cuvsError_t cuvsDeviceIdGet (cuvsResources_t res , int * device_id );
132+ CUVS_EXPORT cuvsError_t cuvsDeviceIdGet (cuvsResources_t res , int * device_id );
131133
132134/**
133135 * @brief Create an Initialized opaque C handle for C++ type `raft::device_resources_snmg`
@@ -136,7 +138,7 @@ cuvsError_t cuvsDeviceIdGet(cuvsResources_t res, int* device_id);
136138 * @param[in] res cuvsResources_t opaque C handle
137139 * @return cuvsError_t
138140 */
139- cuvsError_t cuvsMultiGpuResourcesCreate (cuvsResources_t * res );
141+ CUVS_EXPORT cuvsError_t cuvsMultiGpuResourcesCreate (cuvsResources_t * res );
140142
141143/**
142144 * @brief Create an Initialized opaque C handle for C++ type `raft::device_resources_snmg`
@@ -146,7 +148,7 @@ cuvsError_t cuvsMultiGpuResourcesCreate(cuvsResources_t* res);
146148 * @param[in] device_ids DLManagedTensor* containing device IDs to use
147149 * @return cuvsError_t
148150 */
149- cuvsError_t cuvsMultiGpuResourcesCreateWithDeviceIds (cuvsResources_t * res ,
151+ CUVS_EXPORT cuvsError_t cuvsMultiGpuResourcesCreateWithDeviceIds (cuvsResources_t * res ,
150152 DLManagedTensor * device_ids );
151153
152154/**
@@ -155,7 +157,7 @@ cuvsError_t cuvsMultiGpuResourcesCreateWithDeviceIds(cuvsResources_t* res,
155157 * @param[in] res cuvsResources_t opaque C handle
156158 * @return cuvsError_t
157159 */
158- cuvsError_t cuvsMultiGpuResourcesDestroy (cuvsResources_t res );
160+ CUVS_EXPORT cuvsError_t cuvsMultiGpuResourcesDestroy (cuvsResources_t res );
159161
160162/**
161163 * @brief Set a memory pool on all devices managed by the multi-GPU resources
@@ -164,7 +166,7 @@ cuvsError_t cuvsMultiGpuResourcesDestroy(cuvsResources_t res);
164166 * @param[in] percent_of_free_memory Percent of free memory to allocate for the pool
165167 * @return cuvsError_t
166168 */
167- cuvsError_t cuvsMultiGpuResourcesSetMemoryPool (cuvsResources_t res , int percent_of_free_memory );
169+ CUVS_EXPORT cuvsError_t cuvsMultiGpuResourcesSetMemoryPool (cuvsResources_t res , int percent_of_free_memory );
168170/** @} */
169171
170172/**
@@ -181,7 +183,7 @@ cuvsError_t cuvsMultiGpuResourcesSetMemoryPool(cuvsResources_t res, int percent_
181183 * @param[in] bytes Size in bytes to allocate
182184 * @return cuvsError_t
183185 */
184- cuvsError_t cuvsRMMAlloc (cuvsResources_t res , void * * ptr , size_t bytes );
186+ CUVS_EXPORT cuvsError_t cuvsRMMAlloc (cuvsResources_t res , void * * ptr , size_t bytes );
185187
186188/**
187189 * @brief Deallocates device memory using RMM
@@ -191,7 +193,7 @@ cuvsError_t cuvsRMMAlloc(cuvsResources_t res, void** ptr, size_t bytes);
191193 * @param[in] bytes Size in bytes to allocate
192194 * @return cuvsError_t
193195 */
194- cuvsError_t cuvsRMMFree (cuvsResources_t res , void * ptr , size_t bytes );
196+ CUVS_EXPORT cuvsError_t cuvsRMMFree (cuvsResources_t res , void * ptr , size_t bytes );
195197
196198/**
197199 * @brief Switches the working memory resource to use the RMM pool memory resource, which will
@@ -207,30 +209,30 @@ cuvsError_t cuvsRMMFree(cuvsResources_t res, void* ptr, size_t bytes);
207209 * @param[in] managed Whether to use a managed memory resource as upstream resource or not
208210 * @return cuvsError_t
209211 */
210- cuvsError_t cuvsRMMPoolMemoryResourceEnable (int initial_pool_size_percent ,
212+ CUVS_EXPORT cuvsError_t cuvsRMMPoolMemoryResourceEnable (int initial_pool_size_percent ,
211213 int max_pool_size_percent ,
212214 bool managed );
213215/**
214216 * @brief Resets the memory resource to use the default memory resource (cuda_memory_resource)
215217 * @return cuvsError_t
216218 */
217- cuvsError_t cuvsRMMMemoryResourceReset ();
219+ CUVS_EXPORT cuvsError_t cuvsRMMMemoryResourceReset ();
218220
219221/**
220222 * @brief Allocates pinned memory on the host using RMM
221223 * @param[out] ptr Pointer to allocated host memory
222224 * @param[in] bytes Size in bytes to allocate
223225 * @return cuvsError_t
224226 */
225- cuvsError_t cuvsRMMHostAlloc (void * * ptr , size_t bytes );
227+ CUVS_EXPORT cuvsError_t cuvsRMMHostAlloc (void * * ptr , size_t bytes );
226228
227229/**
228230 * @brief Deallocates pinned memory on the host using RMM
229231 * @param[in] ptr Pointer to allocated host memory to free
230232 * @param[in] bytes Size in bytes to deallocate
231233 * @return cuvsError_t
232234 */
233- cuvsError_t cuvsRMMHostFree (void * ptr , size_t bytes );
235+ CUVS_EXPORT cuvsError_t cuvsRMMHostFree (void * ptr , size_t bytes );
234236
235237/**
236238 * @brief Get the version of the cuVS library
@@ -239,7 +241,7 @@ cuvsError_t cuvsRMMHostFree(void* ptr, size_t bytes);
239241 * @param[out] patch Patch version
240242 * @return cuvsError_t
241243 */
242- cuvsError_t cuvsVersionGet (uint16_t * major , uint16_t * minor , uint16_t * patch );
244+ CUVS_EXPORT cuvsError_t cuvsVersionGet (uint16_t * major , uint16_t * minor , uint16_t * patch );
243245
244246/**
245247 * @brief Copy a matrix
@@ -256,7 +258,7 @@ cuvsError_t cuvsVersionGet(uint16_t* major, uint16_t* minor, uint16_t* patch);
256258 * @param[in] src Pointer to DLManagedTensor to copy
257259 * @param[out] dst Pointer to DLManagedTensor to receive copy of data
258260 */
259- cuvsError_t cuvsMatrixCopy (cuvsResources_t res , DLManagedTensor * src , DLManagedTensor * dst );
261+ CUVS_EXPORT cuvsError_t cuvsMatrixCopy (cuvsResources_t res , DLManagedTensor * src , DLManagedTensor * dst );
260262
261263/**
262264 * @brief Slices rows from a matrix
@@ -267,7 +269,7 @@ cuvsError_t cuvsMatrixCopy(cuvsResources_t res, DLManagedTensor* src, DLManagedT
267269 * @param[in] end Last row index to include in the output
268270 * @param[out] dst Pointer to DLManagedTensor to receive slice from matrix
269271 */
270- cuvsError_t cuvsMatrixSliceRows (
272+ CUVS_EXPORT cuvsError_t cuvsMatrixSliceRows (
271273 cuvsResources_t res , DLManagedTensor * src , int64_t start , int64_t end , DLManagedTensor * dst );
272274/** @} */
273275
0 commit comments