bufferkdtree (C sources)
C source code for the Python bufferkdtree implementation
 All Classes Files Functions Variables Typedefs Macros
Macros | Functions
base.h File Reference
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <time.h>
#include <pthread.h>
#include <string.h>
#include <sched.h>
#include <omp.h>
#include "util.h"
#include "global.h"
#include "../../../include/timing.h"
Include dependency graph for base.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PRINT(params)   if ((params->verbosity_level) > 0) printf
 

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)
 

Macro Definition Documentation

#define PRINT (   params)    if ((params->verbosity_level) > 0) printf

Function Documentation

int extern_check_platform_device ( int  platform_id,
int  device_id 
)

Checks if platform and device are valid

Parameters
platform_idThe OpenCL platform id to be used
device_idThe 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.)

Parameters
*XPointer to array of type "FLOAT_TYPE" (either "float" or "double")
nXNumber of rows in *X (i.e., points/patterns)
dXNumber of columns in *X (one column per point/pattern)
*brute_recordPointer to struct instance storing the model
*paramsPointer 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)

Parameters
*brute_recordPointer to struct storing all relevant information for model
*paramsPointer 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.

Parameters
n_neighborsThe number of nearest neighbors to be found
num_threadsThe number of threads that should be used
platform_idThe OpenCL platform that should be used
device_idThe id of the OpenCL device that should be used
*kernels_source_directoryPointer to string that contains the path to the OpenCL kernels
verbosity_levelThe verbosity level (0==no output, 1==more output, 2==...)
*paramsPointer 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.

Parameters
*XtestPointer to the set of query/test points (stored as FLOAT_TYPE)
nXtestThe number of query points
dXtestThe dimension of each query point
*distancesThe distances array (FLOAT_TYPE) used to store the computed distances
ndistancesThe number of query points
ddistancesThe number of distance values for each query point
*indicesPointer to arrray storing the indices of the k nearest neighbors for each query point
nindicesThe number of query points
dindicesThe number of indices comptued for each query point
*brute_recordPointer to struct storing all relevant information for model
*paramsPointer to struct containing all relevant parameters