bufferkdtree (C sources)
C source code for the Python bufferkdtree implementation
|
#include "include/base.h"
Functions | |
void | init_extern (int n_neighbors, int tree_depth, int num_threads, int num_nXtrain_chunks, int platform_id, int device_id, double allowed_train_mem_percent_chunk, double allowed_test_mem_percent, int splitting_type, char *kernels_source_directory, int verbosity_level, TREE_PARAMETERS *params) |
void | build_bufferkdtree (FLOAT_TYPE *Xtrain, INT_TYPE nXtrain, INT_TYPE dXtrain, TREE_RECORD *tree_record, TREE_PARAMETERS *params) |
void | neighbors_extern (FLOAT_TYPE *Xtest, INT_TYPE nXtest, INT_TYPE dXtest, FLOAT_TYPE *distances, INT_TYPE ndistances, INT_TYPE ddistances, INT_TYPE *indices, INT_TYPE nindices, INT_TYPE dindices, TREE_RECORD *tree_record, TREE_PARAMETERS *params) |
void | extern_free_resources (TREE_RECORD *tree_record, TREE_PARAMETERS *params) |
void | extern_free_query_buffers (TREE_RECORD *tree_record, TREE_PARAMETERS *params) |
long | get_max_nXtest_extern (TREE_RECORD *tree_record, TREE_PARAMETERS *params) |
int | extern_check_platform_device (int platform_id, int device_id) |
void build_bufferkdtree | ( | FLOAT_TYPE * | Xtrain, |
INT_TYPE | nXtrain, | ||
INT_TYPE | dXtrain, | ||
TREE_RECORD * | tree_record, | ||
TREE_PARAMETERS * | params | ||
) |
Builds a buffer k-d-tree
*Xtrain | Pointer to array of type "FLOAT_TYPE" (either "float" or "double") |
nXtrain | Number of rows in *X (i.e., points/patterns) |
dXtrain | Number of columns in *X (one column per point/pattern) |
*tree_record | Pointer to struct instance storing the model |
*params | Pointer to struct instance storing all model parameters |
int extern_check_platform_device | ( | int | platform_id, |
int | device_id | ||
) |
Checks if platform and device are valid
platform_id | The OpenCL platform id to be used |
device_id | The OpenCL device id to be used |
void extern_free_query_buffers | ( | TREE_RECORD * | tree_record, |
TREE_PARAMETERS * | params | ||
) |
Frees opencl test buffers
*tree_record | Pointer to struct storing all relevant information for model |
*params | Pointer to struct containing all relevant parameters |
void extern_free_resources | ( | TREE_RECORD * | tree_record, |
TREE_PARAMETERS * | params | ||
) |
Frees resources (e.g., on the GPU)
*tree_record | Pointer to struct storing all relevant information for model |
*params | Pointer to struct containing all relevant parameters |
long get_max_nXtest_extern | ( | TREE_RECORD * | tree_record, |
TREE_PARAMETERS * | params | ||
) |
Returns maximum number of test queries that can be processed.
*tree_record | Pointer to struct storing all relevant information for model |
*params | Pointer to struct containing all relevant parameters |
void init_extern | ( | int | n_neighbors, |
int | tree_depth, | ||
int | num_threads, | ||
int | num_nXtrain_chunks, | ||
int | platform_id, | ||
int | device_id, | ||
double | allowed_train_mem_percent_chunk, | ||
double | allowed_test_mem_percent, | ||
int | splitting_type, | ||
char * | kernels_source_directory, | ||
int | verbosity_level, | ||
TREE_PARAMETERS * | params | ||
) |
Initializes the *params struct with the parameters provided.
n_neighbors | The number of nearest neighbors to be found |
tree_depth | The tree depth of the tree to be built |
num_threads | The number of threads that should be used |
num_nXtrain_chunks | The number of chunks the training data should be split into |
platform_id | The OpenCL platform that should be used |
device_id | The id of the OpenCL device that should be used |
allowed_train_mem_percent_chunk | The amount of memory (percentage) that the training data may occupy |
allowed_test_mem_percent | The amount of memory (percentage) that the test data may occupy |
splitting_type | The splitting type that can be used during the construction of the tree |
*kernels_source_directory | Pointer to string that contains the path to the OpenCL kernels |
verbosity_level | The verbosity level (0==no output, 1==more output, 2==...) |
*params | Pointer to struct that is used to store all parameters |
void neighbors_extern | ( | FLOAT_TYPE * | Xtest, |
INT_TYPE | nXtest, | ||
INT_TYPE | dXtest, | ||
FLOAT_TYPE * | distances, | ||
INT_TYPE | ndistances, | ||
INT_TYPE | ddistances, | ||
INT_TYPE * | indices, | ||
INT_TYPE | nindices, | ||
INT_TYPE | dindices, | ||
TREE_RECORD * | tree_record, | ||
TREE_PARAMETERS * | params | ||
) |
Interface (extern): Computes the k nearest neighbors for a given set of test points stored in *Xtest and stores the results in two arrays *distances and *indices.
*Xtest | Pointer to the set of query/test points (stored as FLOAT_TYPE) |
nXtest | The number of query points |
dXtest | The dimension of each query point |
*distances | The distances array (FLOAT_TYPE) used to store the computed distances |
ndistances | The number of query points |
ddistances | The number of distance values for each query point |
*indices | Pointer to arrray storing the indices of the k nearest neighbors for each query point |
nindices | The number of query points |
dindices | The number of indices comptued for each query point |
*tree_record | Pointer to struct storing all relevant information for model |
*params | Pointer to struct containing all relevant parameters |