GPUMLib  0.2.2
GPU Machine Learning Library
kmeanskernels.h
1 /*
2  Ricardo Quintas is an MSc Student at the University of Coimbra, Portugal
3  Copyright (C) 2009, 2010 Ricardo Quintas
4 
5  This file is part of GPUMLib.
6 
7  GPUMLib is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
23 #ifndef KMeanskernels_h
24 #define KMeanskernels_h
25 
26 #include "../common/CudaDefinitions.h"
27 #include "../memory/DeviceArray.h"
28 #include "../memory/DeviceMatrix.h"
29 
30 #define imax(X, Y) ((X) > (Y) ? (X) : (Y))
31 #define imin(X, Y) ((X) < (Y) ? (X) : (Y))
32 #define round(x) (x<0?ceil((x)-0.5):floor((x)+0.5))
33 
34 /*Define functions to call CUDA kernels in C program*/
35 
36 /*Functions for KMEANS standard*/
37 
46 extern "C" void KernelEuclidianDistance(cudafloat *d_C, cudafloat* d_A, cudafloat* d_B,int uiWA,int uiWB, int uiWC, int uiHC);
47 
53 extern "C" void KernelCenterAttribution(cudafloat *Output, int output_height, int output_width, int *attrib_center);
54 
60 extern "C" void KernelPrepareCenterCopy(cudafloat *Output, int output_height, int output_width, int *attrib_center);
61 
72 extern "C" void KernelCopyCenters(cudafloat *Output, int output_height, int output_width, cudafloat *Input,int input_height, int *attrib_center,cudafloat *Indexes, int idx_height, int idx_width);
73 
79 extern "C" void KernelReduce2(int *output, int *input, int *g_idata_old,int n);
80 
81 
82 /*Function for KMEANS with triangle inequality*/
83 
90 extern "C" void KernelCenterAttribution_Bounds(cudafloat *Output, int output_height, int output_width, int *attrib_center, float* upperbound);
91 
99 extern "C" void KernelCopyCenters2(cudafloat *Output, int output_height, int output_width, cudafloat *Input,int input_width, int *attrib_center);
100 
106 extern "C" void KernelS(cudafloat *Output, int output_height, int output_width, float *S);
107 
121 extern "C" void KernelStep3(float*Input,int input_height, float* Upperbounds, float* S,bool* R,int* CenterAttrib,float* LowerBounds,float* DistanceBeetweenCenters,float* InitialDistances, float* NewCenters,int centers_height,int centers_width);
122 
127 extern "C" void KernelReduce_bool(bool *output, bool *input,int n);
128 
140 extern "C" void KernelStep5(int input_height, float* Upperbounds, bool* R,int* CenterAttrib,float* LowerBounds,float* DistanceBeetweenCenters,float* InitialDistances, float* NewCenters,int centers_height,int centers_width);
141 
142 
143 /*Auxiliary functions*/
144 extern "C" unsigned int nextPow2( unsigned int x );
145 
146 #endif
147 
148 //! @}
void KernelReduce_bool(bool *output, bool *input, int n)
void KernelCopyCenters2(cudafloat *Output, int output_height, int output_width, cudafloat *Input, int input_width, int *attrib_center)
void KernelReduce2(int *output, int *input, int *g_idata_old, int n)
void KernelCopyCenters(cudafloat *Output, int output_height, int output_width, cudafloat *Input, int input_height, int *attrib_center, cudafloat *Indexes, int idx_height, int idx_width)
void KernelS(cudafloat *Output, int output_height, int output_width, float *S)
void KernelCenterAttribution(cudafloat *Output, int output_height, int output_width, int *attrib_center)
void KernelStep5(int input_height, float *Upperbounds, bool *R, int *CenterAttrib, float *LowerBounds, float *DistanceBeetweenCenters, float *InitialDistances, float *NewCenters, int centers_height, int centers_width)
void KernelCenterAttribution_Bounds(cudafloat *Output, int output_height, int output_width, int *attrib_center, float *upperbound)
void KernelStep3(float *Input, int input_height, float *Upperbounds, float *S, bool *R, int *CenterAttrib, float *LowerBounds, float *DistanceBeetweenCenters, float *InitialDistances, float *NewCenters, int centers_height, int centers_width)
void KernelEuclidianDistance(cudafloat *d_C, cudafloat *d_A, cudafloat *d_B, int uiWA, int uiWB, int uiWC, int uiHC)
float cudafloat
void KernelPrepareCenterCopy(cudafloat *Output, int output_height, int output_width, int *attrib_center)