#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"
Go to the source code of this file.
|
#define | PRINT(params) if ((params->verbosity_level) > 0) printf |
|
|
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) |
|
#define PRINT |
( |
|
params | ) |
if ((params->verbosity_level) > 0) printf |
int extern_check_platform_device |
( |
int |
platform_id, |
|
|
int |
device_id |
|
) |
| |
Checks if platform and device are valid
- Parameters
-
platform_id | The OpenCL platform id to be used |
device_id | The OpenCL device id to be used |
Interface (extern): Fits the model (e.g., intializes OPenCL device etc.)
- Parameters
-
*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 |
Frees resources (e.g., on the GPU)
- Parameters
-
*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.
- Parameters
-
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.
- Parameters
-
*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 |