bufferkdtree (C sources)
C source code for the Python bufferkdtree implementation
|
#include "include/base.h"
#include "include/util.h"
#include "include/cpu.h"
#include "include/gpu_opencl.h"
#include "include/global.h"
Functions | |
void | init_extern (int n_neighbors, int num_threads, int platform_id, int device_id, char *kernels_source_directory, int verbosity_level, BRUTE_PARAMETERS *params) |
void | fit_extern (FLOAT_TYPE *X, int nX, int dX, BRUTE_RECORD *brute_record, BRUTE_PARAMETERS *params) |
void | neighbors_extern (FLOAT_TYPE *Xtest, int nXtest, int dXtest, FLOAT_TYPE *distances, int ndistances, int ddistances, int *indices, int nindices, int dindices, BRUTE_RECORD *brute_record, BRUTE_PARAMETERS *params) |
void | free_resources_extern (BRUTE_RECORD *brute_record, BRUTE_PARAMETERS *params) |
int | extern_check_platform_device (int platform_id, int device_id) |
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 fit_extern | ( | FLOAT_TYPE * | X, |
int | nX, | ||
int | dX, | ||
BRUTE_RECORD * | brute_record, | ||
BRUTE_PARAMETERS * | params | ||
) |
Interface (extern): Fits the model (e.g., intializes OPenCL device etc.)
*X | Pointer to array of type "FLOAT_TYPE" (either "float" or "double") |
nX | Number of rows in *X (i.e., points/patterns) |
dX | Number of columns in *X (one column per point/pattern) |
*brute_record | Pointer to struct instance storing the model |
*params | Pointer to struct instance storing all model parameters |
void free_resources_extern | ( | BRUTE_RECORD * | brute_record, |
BRUTE_PARAMETERS * | params | ||
) |
Frees resources (e.g., on the GPU)
*brute_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 | num_threads, | ||
int | platform_id, | ||
int | device_id, | ||
char * | kernels_source_directory, | ||
int | verbosity_level, | ||
BRUTE_PARAMETERS * | params | ||
) |
Initializes the *params struct with the parameters provided.
n_neighbors | The number of nearest neighbors to be found |
num_threads | The number of threads that should be used |
platform_id | The OpenCL platform that should be used |
device_id | The id of the OpenCL device that should be used |
*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 | nXtest, | ||
int | dXtest, | ||
FLOAT_TYPE * | distances, | ||
int | ndistances, | ||
int | ddistances, | ||
int * | indices, | ||
int | nindices, | ||
int | dindices, | ||
BRUTE_RECORD * | brute_record, | ||
BRUTE_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 |
*brute_record | Pointer to struct storing all relevant information for model |
*params | Pointer to struct containing all relevant parameters |