Typedefs | Enumerations | Functions
cuml_api.h File Reference
#include <cuda_runtime_api.h>
#include <stddef.h>
Include dependency graph for cuml_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef int cumlHandle_t
 
typedef enum cumlError_t cumlError_t
 
typedef cudaError_t(* cuml_allocate) (void **p, size_t n, cudaStream_t stream)
 
typedef cudaError_t(* cuml_deallocate) (void *p, size_t n, cudaStream_t stream)
 

Enumerations

enum  cumlError_t { CUML_SUCCESS , CUML_ERROR_UNKNOWN , CUML_INVALID_HANDLE }
 

Functions

const char * cumlGetErrorString (cumlError_t error)
 Get a human readable error string for the passed in error code. More...
 
cumlError_t cumlCreate (cumlHandle_t *handle, cudaStream_t stream)
 Creates a cumlHandle_t. More...
 
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. More...
 
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. More...
 
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. More...
 
cumlError_t cumlDestroy (cumlHandle_t handle)
 Release all resource internally managed by cumlHandle_t. More...
 

Typedef Documentation

◆ cuml_allocate

typedef cudaError_t(* cuml_allocate) (void **p, size_t n, cudaStream_t stream)

◆ cuml_deallocate

typedef cudaError_t(* cuml_deallocate) (void *p, size_t n, cudaStream_t stream)

◆ cumlError_t

typedef enum cumlError_t cumlError_t

◆ cumlHandle_t

typedef int cumlHandle_t

Enumeration Type Documentation

◆ cumlError_t

Enumerator
CUML_SUCCESS 
CUML_ERROR_UNKNOWN 
CUML_INVALID_HANDLE 

Function Documentation

◆ cumlCreate()

cumlError_t cumlCreate ( cumlHandle_t handle,
cudaStream_t  stream 
)

Creates a cumlHandle_t.

Parameters
[in,out]handlepointer to the handle to create.
[in]streamthe stream to which cuML work should be ordered.
Returns
CUML_SUCCESS on success,
Todo:
: add more error codes

◆ cumlDestroy()

cumlError_t cumlDestroy ( cumlHandle_t  handle)

Release all resource internally managed by cumlHandle_t.

Parameters
[in,out]handlethe cumlHandle_t to destroy.
Returns
CUML_SUCCESS on success,
Todo:
: add more error codes

◆ cumlGetErrorString()

const char* cumlGetErrorString ( cumlError_t  error)

Get a human readable error string for the passed in error code.

Parameters
[in]errorthe error code to decipher.
Returns
a string with a human readable error message.

◆ cumlGetStream()

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.

Parameters
[in,out]handlehandle to set the stream for.
[in]streamthe stream to which cuML work should be ordered.
Returns
CUML_SUCCESS on success,
Todo:
: add more error codes

◆ cumlSetDeviceAllocator()

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.

Example use:

cudaError_t device_allocate(void** p,size_t n, cudaStream_t)
{
return cudaMalloc(p,n);
}
cudaError_t device_deallocate(void* p, size_t, cudaStream_t)
{
return cudaFree(p);
}
void foo()
{
cumlHandle_t cumlHandle;
cumlCreate( &cumlHandle );
cumlSetDeviceAllocator( cumlHandle, device_allocate, device_deallocate );
cumlDestroy( cumlHandle );
}
int cumlHandle_t
Definition: cuml_api.h:37
cumlError_t cumlCreate(cumlHandle_t *handle, cudaStream_t stream)
Creates a cumlHandle_t.
Definition: cuml_api.cpp:37
cumlError_t cumlDestroy(cumlHandle_t handle)
Release all resource internally managed by cumlHandle_t.
Definition: cuml_api.cpp:66
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.
Parameters
[in,out]handlethe cumlHandle_t to set the device allocator for.
[in]allocate_fnfunction pointer to the allocate function to use for device allocations.
[in]deallocate_fnfunction pointer to the deallocate function to use for device allocations.
Returns
CUML_SUCCESS on success,
Todo:
: add more error codes

◆ cumlSetHostAllocator()

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.

Example use:

cudaError_t host_allocate(void** p,size_t n, cudaStream_t)
{
*p = malloc(n);
return NULL != *p ? cudaSuccess : cudaErrorUnknown;
}
cudaError_t host_deallocate(void* p, size_t, cudaStream_t stream)
{
free(p);
return cudaSuccess;
}
void foo()
{
cumlHandle_t cumlHandle;
cumlCreate( &cumlHandle );
cumlSetHostAllocator( cumlHandle, host_allocate, host_deallocate );
cumlDestroy( cumlHandle );
}
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.
void free(const raft::handle_t &h, forest_t< real_t > f)
Parameters
[in,out]handlethe cumlHandle_t to set the host allocator for.
[in]allocate_fnfunction pointer to the allocate function to use for host allocations.
[in]deallocate_fnfunction pointer to the deallocate function to use for host allocations.
Returns
CUML_SUCCESS on success,
Todo:
: add more error codes