cuml_api.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #pragma once
7 
8 #include <cuda_runtime_api.h>
9 
10 #include <stddef.h>
11 
12 // Block inclusion of this header when compiling libcuml++.so. If this error is
13 // shown during compilation, there is an issue with how the `#include` have
14 // been set up. To debug the issue, run `./build.sh cppdocs` and open the page
15 // 'cpp/build/html/cuml__api_8h.html' in a browser. This will show which files
16 // directly and indirectly include this file. Only files ending in '*_api' or
17 // 'cumlHandle' should include this header.
18 #ifdef CUML_CPP_API
19 #error "This header is only for the C-API and should not be included from the C++ API."
20 #endif
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 typedef int cumlHandle_t;
27 
29 
30 typedef cudaError_t (*cuml_allocate)(void** p, size_t n, cudaStream_t stream);
31 typedef cudaError_t (*cuml_deallocate)(void* p, size_t n, cudaStream_t stream);
32 
39 const char* cumlGetErrorString(cumlError_t error);
40 
48 cumlError_t cumlCreate(cumlHandle_t* handle, cudaStream_t stream);
49 
57 cumlError_t cumlGetStream(cumlHandle_t handle, cudaStream_t* stream);
58 
92  cuml_allocate allocate_fn,
93  cuml_deallocate deallocate_fn);
128  cuml_allocate allocate_fn,
129  cuml_deallocate deallocate_fn);
130 
138 
139 #ifdef __cplusplus
140 }
141 #endif
cudaError_t(* cuml_deallocate)(void *p, size_t n, cudaStream_t stream)
Definition: cuml_api.h:31
cudaError_t(* cuml_allocate)(void **p, size_t n, cudaStream_t stream)
Definition: cuml_api.h:30
int cumlHandle_t
Definition: cuml_api.h:26
const char * cumlGetErrorString(cumlError_t error)
Get a human readable error string for the passed in error code.
Definition: cuml_api.cpp:16
cumlError_t cumlCreate(cumlHandle_t *handle, cudaStream_t stream)
Creates a cumlHandle_t.
Definition: cuml_api.cpp:26
cumlError_t cumlDestroy(cumlHandle_t handle)
Release all resource internally managed by cumlHandle_t.
Definition: cuml_api.cpp:55
cumlError_t cumlSetDeviceAllocator(cumlHandle_t handle, cuml_allocate allocate_fn, cuml_deallocate deallocate_fn)
sets the allocator to use for all device allocations done in cuML.
cumlError_t cumlGetStream(cumlHandle_t handle, cudaStream_t *stream)
sets the stream to which all cuML work issued via the passed handle should be ordered.
Definition: cuml_api.cpp:33
cumlError_t
Definition: cuml_api.h:28
@ CUML_INVALID_HANDLE
Definition: cuml_api.h:28
@ CUML_SUCCESS
Definition: cuml_api.h:28
@ CUML_ERROR_UNKNOWN
Definition: cuml_api.h:28
cumlError_t cumlSetHostAllocator(cumlHandle_t handle, cuml_allocate allocate_fn, cuml_deallocate deallocate_fn)
sets the allocator to use for substantial host allocations done in cuML.