00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 int CudaLCP_MultVector_ResSize(unsigned int dim) {
00026 return (dim+BSIZE-1)/BSIZE;
00027 }
00028
00029 int CudaNLCP_MultVector_ResSize(unsigned int dim) {
00030 return (dim+MBSIZE-1)/MBSIZE;
00031 }
00032
00034
00035 void CudaLCP_MultVectorf(int dim,int index, const void * m,const void * f,void * r) {
00036 dim3 threads(BSIZE,1);
00037 dim3 grid((dim+BSIZE-1)/BSIZE,1);
00038
00039 CudaLCP_MultVector_kernel<float><<< grid, threads, threads.x*sizeof(float) >>>(dim, index, (const float*)m, (const float*)f, (float*)r, BSIZE/2);
00040 }
00041 void CudaLCP_MultVectord(int dim,int index, const void * m,const void * f,void * r) {
00042 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00043 myprintf("CUDA ERROR: double precision not supported.\n");
00044 #else
00045 dim3 threads(BSIZE,1);
00046 dim3 grid((dim+BSIZE-1)/BSIZE,1);
00047
00048 CudaLCP_MultVector_kernel<double><<< grid, threads, threads.x*sizeof(double) >>>(dim, index, (const double*)m, (const double*)f, (double*)r, BSIZE/2);
00049 #endif
00050 }
00051
00052 void CudaLCP_ComputeErrorf(int compteur2,int sizeTmp, const void * tmp, const void * M,const void * q,void * f,void * error) {
00053 dim3 threads(sizeTmp,1);
00054 dim3 grid(1,1);
00055 int offset;
00056 if (sizeTmp==1) offset = 0;
00057 else {
00058 offset = 1;
00059 while (offset*2 < sizeTmp) offset *= 2;
00060 }
00061
00062 CudaLCP_ComputeError_kernel<float><<< grid, threads, threads.x*sizeof(float) >>>(compteur2,(const float*)tmp, (const float*)M,(const float*)q, (float*)f,(float*)error,offset);
00063 }
00064 void CudaLCP_ComputeErrord(int compteur2,int sizeTmp, const void * tmp, const void * M,const void * q,void * f,void * error) {
00065 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00066 myprintf("CUDA ERROR: double precision not supported.\n");
00067 #else
00068 dim3 threads(sizeTmp,1);
00069 dim3 grid(1,1);
00070 int offset;
00071 if (sizeTmp==1) offset = 0;
00072 else {
00073 offset = 1;
00074 while (offset*2 < sizeTmp) offset *= 2;
00075 }
00076
00077 CudaLCP_ComputeError_kernel<double><<< grid, threads, threads.x*sizeof(double) >>>(compteur2,(const double*)tmp, (const double*)M,(const double*)q, (double*)f,(double*)error,offset);
00078 #endif
00079 }
00080
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 void CudaLCP_MultIndepf(int dim,const void * m,int pM,const void * f,void * tmp,int pTmp) {
00092 dim3 threads(BSIZE,1);
00093 dim3 grid((dim+BSIZE-1)/BSIZE,dim);
00094
00095 CudaLCP_MultIndep_kernel<float><<< grid, threads,0>>>(dim, (const float*)m,pM,(const float*)f,(float*)tmp,pTmp,BSIZE/2);
00096 }
00097 void CudaLCP_MultIndepd(int dim,const void * m,int pM,const void * f,void * tmp,int pTmp) {
00098 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00099 myprintf("CUDA ERROR: double precision not supported.\n");
00100 #else
00101 dim3 threads(BSIZE,1);
00102 dim3 grid((dim+BSIZE-1)/BSIZE,dim);
00103
00104 CudaLCP_MultIndep_kernel<double><<< grid, threads,0>>>(dim, (const double*)m,pM,(const double*)f,(double*)tmp,pTmp,BSIZE/2);
00105 #endif
00106 }
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116 void CudaLCP_AddIndepf(int dim,int tmpsize,const void * q,const void * tmp,int pTmp,void * res) {
00117 dim3 threads(tmpsize,1);
00118 dim3 grid(dim,1);
00119
00120 CudaLCP_AddIndep_kernel<float><<< grid, threads,threads.x*sizeof(float)>>>(dim,tmpsize,(const float*)q,(const float*)tmp,pTmp,(float*)res,tmpsize);
00121 }
00122 void CudaLCP_AddIndepd(int dim,int tmpsize,const void * q,const void * tmp,int pTmp,void * res) {
00123 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00124 myprintf("CUDA ERROR: double precision not supported.\n");
00125 #else
00126 dim3 threads(tmpsize,1);
00127 dim3 grid(dim,1);
00128
00129 CudaLCP_AddIndep_kernel<double><<< grid, threads,threads.x*sizeof(double)>>>(dim,tmpsize,(const double*)q,(const double*)tmp,pTmp,(double*)res,tmpsize);
00130 #endif
00131 }
00132
00133 void CudaLCP_AddIndepAndUpdatef(int dim,int tmpsize,const void * m,const void * q,const void * tmp,int pTmp,void * f,void * res,void * err) {
00134 dim3 threads(tmpsize,1);
00135 dim3 grid(dim,1);
00136
00137 CudaLCP_AddIndepAndUpdate_kernel<float><<< grid, threads,threads.x*sizeof(float)>>>(dim,tmpsize,(const float*)m,(const float*)q,(const float*)tmp,pTmp,(float*)f,(float*)res,(float*)err,tmpsize);
00138 }
00139 void CudaLCP_AddIndepAndUpdated(int dim,int tmpsize,const void * m,const void * q,const void * tmp,int pTmp,void * f,void * res,void * err) {
00140 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00141 myprintf("CUDA ERROR: double precision not supported.\n");
00142 #else
00143 dim3 threads(tmpsize,1);
00144 dim3 grid(dim,1);
00145
00146 CudaLCP_AddIndepAndUpdate_kernel<double><<< grid, threads,threads.x*sizeof(double)>>>(dim,tmpsize,(const double*)m,(const double*)q,(const double*)tmp,pTmp,(double*)f,(double*)res,(double*)err,tmpsize);
00147 #endif
00148 }
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161 void CudaLCP_ComputeNextIter_V2f(int dim,int compteur2,const void * m,int mP,const void * q,void * f,void * err,void * res) {
00162 dim3 threads(BSIZE,1);
00163 dim3 grid((dim+BSIZE-1)/BSIZE,1);
00164
00165 CudaLCP_ComputeNextIter_kernel_V2<float><<< grid, threads,0 >>>(dim,compteur2,(const float*) m,mP,(const float *) q,(float*)f, (float*) err,(float *)res);
00166 }
00167 void CudaLCP_ComputeNextIter_V2d(int dim,int compteur2,const void * m,int mP,const void * q,void * f,void * err,void * res) {
00168 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00169 myprintf("CUDA ERROR: double precision not supported.\n");
00170 #else
00171 dim3 threads(BSIZE,1);
00172 dim3 grid((dim+BSIZE-1)/BSIZE,1);
00173
00174 CudaLCP_ComputeNextIter_kernel_V2<double><<< grid, threads,0 >>>(dim,compteur2,(const double*) m,mP,(const double *) q,(double*)f, (double*) err,(double *)res);
00175 #endif
00176 }
00177
00179
00180 void CudaLCP_ComputeNextIter_V3_OneKernelf(int dim,const void * m,int mP,const void * q,void * f,void * err,void * res) {
00181 dim3 threads(dim,1);
00182 dim3 grid(1,1);
00183
00184 CudaLCP_ComputeNextIter_V3_OneKernel_kernel<float><<< grid, threads,0 >>>(dim,(const float*) m,mP,(const float *) q,(float*)f, (float*) err,(float *)res);
00185 }
00186 void CudaLCP_ComputeNextIter_V3_OneKerneld(int dim,const void * m,int mP,const void * q,void * f,void * err,void * res) {
00187 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00188 myprintf("CUDA ERROR: double precision not supported.\n");
00189 #else
00190 dim3 threads(dim,1);
00191 dim3 grid(1,1);
00192
00193 CudaLCP_ComputeNextIter_V3_OneKernel_kernel<double><<< grid, threads,0 >>>(dim,(const double*) m,mP,(const double *) q,(double*)f, (double*) err,(double *)res);
00194 #endif
00195 }
00196
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218 void CudaLCP_ComputeNextIter_V4_DepKernelf(int d,int debutblock,const void * m,int mP,const void * q,void * f,void * err,void * res) {
00219 dim3 threads(BSIZE,1);
00220 dim3 grid(1,1);
00221
00222 CudaLCP_ComputeNextIter_V4_DepKernel_kernel<float><<< grid, threads,0>>>(d,debutblock,(const float*) m,mP,(const float *) q,(float*)f, (float*) err,(float *)res);
00223 }
00224 void CudaLCP_ComputeNextIter_V4_DepKerneld(int d,int debutblock,const void * m,int mP,const void * q,void * f,void * err,void * res) {
00225 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00226 myprintf("CUDA ERROR: double precision not supported.\n");
00227 #else
00228 dim3 threads(BSIZE,1);
00229 dim3 grid(1,1);
00230
00231 CudaLCP_ComputeNextIter_V4_DepKernel_kernel<double><<< grid, threads,0>>>(d,debutblock,(const double*) m,mP,(const double *) q,(double*)f, (double*) err,(double *)res);
00232 #endif
00233 }
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245 void CudaLCP_ComputeNextIter_V4_InDepKernelf(int dim,int d,int debutBlock,const void * m,int mP,const void * f,void * res) {
00246 dim3 threads(BSIZE,1);
00247 dim3 grid(1,dim-d);
00248
00249 CudaLCP_ComputeNextIter_V4_InDepKernel_kernel<float><<< grid, threads,0>>>(dim,debutBlock,(const float*) m,mP,(const float*)f, (float *)res,BSIZE/2);
00250 }
00251 void CudaLCP_ComputeNextIter_V4_InDepKerneld(int dim,int d,int debutBlock,const void * m,int mP,const void * f,void * res) {
00252 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00253 myprintf("CUDA ERROR: double precision not supported.\n");
00254 #else
00255 dim3 threads(BSIZE,1);
00256 dim3 grid(1,dim-d);
00257
00258 CudaLCP_ComputeNextIter_V4_InDepKernel_kernel<double><<< grid, threads,0>>>(dim,debutBlock,(const double*) m,mP,(const double*)f, (double *)res,BSIZE/2);
00259 #endif
00260 }
00261
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278 void CudaLCP_ComputeNextIter_V5_FirstKernelf(const void * m,int mP,const void * q,void * f,void * res) {
00279 dim3 threads(BSIZE,1);
00280 dim3 grid(1,1);
00281
00282 CudaLCP_ComputeNextIter_V5_FirstKernel_kernel<float><<< grid, threads,0 >>>((const float*) m,mP,(const float *) q,(float*)f,(float *)res);
00283
00284 }
00285 void CudaLCP_ComputeNextIter_V5_FirstKerneld(const void * m,int mP,const void * q,void * f,void * res) {
00286 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00287 myprintf("CUDA ERROR: double precision not supported.\n");
00288 #else
00289 dim3 threads(BSIZE,1);
00290 dim3 grid(1,1);
00291
00292 CudaLCP_ComputeNextIter_V5_FirstKernel_kernel<double><<< grid, threads,0 >>>((const double*) m,mP,(const double *) q,(double*)f,(double *)res);
00293 #endif
00294 }
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335 void CudaLCP_ComputeNextIter_V5_SecondKernelf(int dim,int nbth,int d,int ligne,int colone,const void * m,int mP,const void * q,void * f,void * err,void * res) {
00336 dim3 threads(BSIZE,1);
00337 dim3 grid(1,nbth+1);
00338
00339 CudaLCP_ComputeNextIter_V5_SecondKernel_kernel<float><<< grid, threads,0 >>>(dim,d,ligne,colone,(const float*) m,mP,(const float *) q,(float*)f,(float*)err,(float *)res,BSIZE/2);
00340 }
00341 void CudaLCP_ComputeNextIter_V5_SecondKerneld(int dim,int nbth,int d,int ligne,int colone,const void * m,int mP,const void * q,void * f,void * err,void * res) {
00342 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00343 myprintf("CUDA ERROR: double precision not supported.\n");
00344 #else
00345 dim3 threads(BSIZE,1);
00346 dim3 grid(1,nbth+1);
00347
00348 CudaLCP_ComputeNextIter_V5_SecondKernel_kernel<double><<< grid, threads,0 >>>(dim,d,ligne,colone,(const double*) m,mP,(const double *) q,(double*)f,(double*)err,(double *)res,BSIZE/2);
00349 #endif
00350 }
00351
00353
00354 void CudaLCP_FullKernel_V6f(int dim,int itMax,float tol,const void * m,int mP,const void * q,void * f,void * err,void * share) {
00355 dim3 threads(BSIZE_C,1);
00356 dim3 grid(1,NB_MULTIPROC);
00357
00358 CudaLCP_FullKernel_V6_kernel<<< grid, threads,threads.x*threads.y*sizeof(float)>>>(dim,dim*itMax,tol,(const float *) m,mP,(const float *) q,(float *) f,(float *) err,(int *) share);
00359
00360 }
00361 void CudaLCP_FullKernel_V6d(int dim,int itMax,float tol,const void * m,int mP,const void * q,void * f,void * err,void * share) {
00362 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00363 myprintf("CUDA ERROR: double precision not supported.\n");
00364 #else
00365 dim3 threads(BSIZE_C,1);
00366 dim3 grid(1,NB_MULTIPROC);
00367
00368 CudaLCP_FullKernel_V6_kernel<<< grid, threads,threads.x*threads.y*sizeof(double)>>>(dim,dim*itMax,(double)tol,(const double *) m,mP,(const double *) q,(double *) f,(double *) err,(int *) share);
00369 #endif
00370 }
00371
00373
00374 void CudaLCP_FullKernel_V7f(int dim,int itMax,float tol,const void * m,int mP,const void * q,void * f,void * err,void * share) {
00375 dim3 threads(BSIZE_C,BSIZE_L);
00376 dim3 grid(1,NB_MULTIPROC);
00377 int dim_n = (dim+BSIZE_L-1)/BSIZE_L * BSIZE_L;
00378
00379 CudaLCP_FullKernel_V7_kernel<<< grid, threads,0>>>(dim,dim_n,dim_n*itMax,tol,(const float *) m,mP,(const float *) q,(float *) f,(float *) err,(int *) share);
00380 }
00381 void CudaLCP_FullKernel_V7d(int dim,int itMax,float tol,const void * m,int mP,const void * q,void * f,void * err,void * share) {
00382 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00383 myprintf("CUDA ERROR: double precision not supported.\n");
00384 #else
00385 dim3 threads(BSIZE_C,BSIZE_L);
00386 dim3 grid(1,NB_MULTIPROC);
00387 int dim_n = (dim+BSIZE_L-1)/BSIZE_L * BSIZE_L;
00388
00389 CudaLCP_FullKernel_V7_kernel<<< grid, threads,0>>>(dim,dim_n,dim_n*itMax,(double)tol,(const double *) m,mP,(const double *) q,(double *) f,(double *) err,(int *) share);
00390
00391 #endif
00392 }
00393
00395
00396 void CudaLCP_FullKernel_V8f(int dim,int itMax,float tol,const void * m,int mP,const void * q,void * f,void * err,void * share) {
00397 dim3 threads(BSIZE_C,BSIZE_C);
00398 dim3 grid(1,NB_MULTIPROC);
00399 int dim_n = (dim+BSIZE_C-1)/BSIZE_C * BSIZE_C;
00400
00401 CudaLCP_FullKernel_V8_kernel<<< grid, threads,0>>>(dim,dim_n,dim_n*itMax,tol,(const float *) m,mP,(const float *) q,(float *) f,(float *) err,(int *) share);
00402 }
00403 void CudaLCP_FullKernel_V8d(int dim,int itMax,float tol,const void * m,int mP,const void * q,void * f,void * err,void * share) {
00404 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00405 myprintf("CUDA ERROR: double precision not supported.\n");
00406 #else
00407 dim3 threads(BSIZE_C,BSIZE_C);
00408 dim3 grid(1,NB_MULTIPROC);
00409 int dim_n = (dim+BSIZE_C-1)/BSIZE_C * BSIZE_C;
00410
00411 CudaLCP_FullKernel_V8_kernel<<< grid, threads,0>>>(dim,dim_n,dim_n*itMax,(double)tol,(const double *) m,mP,(const double *) q,(double *) f,(double *) err,(int *) share);
00412
00413 #endif
00414 }
00415
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435 void CudaNLCP_MultIndepf(int dim,const void * m,int pM,const void * f,void * tmp,int pTmp) {
00436 dim3 threads(MBSIZE,1);
00437 dim3 grid((dim+MBSIZE-1)/MBSIZE,dim);
00438
00439 CudaNLCP_MultIndep_kernel<float><<< grid, threads,0>>>(dim, (const float*)m,pM,(const float*)f,(float*)tmp,pTmp);
00440 }
00441 void CudaNLCP_MultIndepd(int dim,const void * m,int pM,const void * f,void * tmp,int pTmp) {
00442 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00443 myprintf("CUDA ERROR: double precision not supported.\n");
00444 #else
00445 dim3 threads(MBSIZE,1);
00446 dim3 grid((dim+MBSIZE-1)/MBSIZE,dim);
00447
00448 CudaNLCP_MultIndep_kernel<double><<< grid, threads,0>>>(dim, (const double*)m,pM,(const double*)f,(double*)tmp,pTmp);
00449 #endif
00450 }
00451
00452 void CudaNLCP_AddIndepf(int dim,int tmpsize,const void * q,const void * tmp,int pTmp,void * res) {
00453 dim3 threads(tmpsize,1);
00454 dim3 grid(dim,1);
00455
00456 CudaNLCP_AddIndep_kernel<float><<< grid, threads,threads.x*sizeof(float)>>>(dim,tmpsize,(const float*)q,(const float*)tmp,pTmp,(float*)res);
00457 }
00458 void CudaNLCP_AddIndepd(int dim,int tmpsize,const void * q,const void * tmp,int pTmp,void * res) {
00459 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00460 myprintf("CUDA ERROR: double precision not supported.\n");
00461 #else
00462 dim3 threads(tmpsize,1);
00463 dim3 grid(dim,1);
00464
00465 CudaNLCP_AddIndep_kernel<double><<< grid, threads,threads.x*sizeof(double)>>>(dim,tmpsize,(const double*)q,(const double*)tmp,pTmp,(double*)res);
00466 #endif
00467 }
00468
00469 void CudaNLCP_ComputeNextIter_V1_InDepKernelf(int dim,int d,int debutBlock,const void * m,int mP,const void * f,void * res) {
00470 dim3 threads(MBSIZE,1);
00471 dim3 grid(1,dim-d);
00472
00473 CudaNLCP_ComputeNextIter_V1_InDepKernel_kernel<float><<< grid, threads,0>>>(dim,debutBlock,(const float*) m,mP,(const float*)f, (float *)res);
00474 }
00475 void CudaNLCP_ComputeNextIter_V1_InDepKerneld(int dim,int d,int debutBlock,const void * m,int mP,const void * f,void * res) {
00476 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00477 myprintf("CUDA ERROR: double precision not supported.\n");
00478 #else
00479 dim3 threads(MBSIZE,1);
00480 dim3 grid(1,dim-d);
00481
00482 CudaNLCP_ComputeNextIter_V1_InDepKernel_kernel<double><<< grid, threads,0>>>(dim,debutBlock,(const double*) m,mP,(const double*)f, (double *)res);
00483 #endif
00484 }
00485
00486 void CudaNLCP_ComputeNextIter_V1_DepKernelf(int d,int debutblock,float mu,const void * m,int mP,const void * q,void * f,void * err,void * res) {
00487 dim3 threads(MBSIZE,1);
00488 dim3 grid(1,1);
00489
00490 CudaNLCP_ComputeNextIter_V1_DepKernel_kernel<float><<< grid, threads,0>>>(d,debutblock,mu,(const float*) m,mP,(const float *) q,(float*)f, (float*) err,(float *)res);
00491 }
00492 void CudaNLCP_ComputeNextIter_V1_DepKerneld(int d,int debutblock,float mu,const void * m,int mP,const void * q,void * f,void * err,void * res) {
00493 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00494 myprintf("CUDA ERROR: double precision not supported.\n");
00495 #else
00496 dim3 threads(MBSIZE,1);
00497 dim3 grid(1,1);
00498
00499 CudaNLCP_ComputeNextIter_V1_DepKernel_kernel<double><<< grid, threads,0>>>(d,debutblock,(double)mu,(const double*) m,mP,(const double *) q,(double*)f, (double*) err,(double *)res);
00500 #endif
00501 }
00502
00503 void CudaNLCP_FullKernel_V2f(int dim,int itMax,float tol,float mu,const void * m,int mP,const void * q,void * f,void * err,void * share) {
00504 dim3 threads(MBSIZE_C,MBSIZE_C);
00505 dim3 grid(1,NB_MULTIPROC);
00506 int dim_n = (dim+MBSIZE_C-1)/MBSIZE_C * MBSIZE_C;
00507
00508 CudaNLCP_FullKernel_V2_kernel<float><<< grid, threads,0>>>(dim,dim_n,dim_n*itMax,tol,mu,(const float *) m,mP,(const float *) q,(float *) f,(float *) err,(int *) share);
00509 }
00510 void CudaNLCP_FullKernel_V2d(int dim,int itMax,float tol,float mu,const void * m,int mP,const void * q,void * f,void * err,void * share) {
00511 #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ < 130
00512 myprintf("CUDA ERROR: double precision not supported.\n");
00513 #else
00514 dim3 threads(MBSIZE_C,MBSIZE_C);
00515 dim3 grid(1,NB_MULTIPROC);
00516 int dim_n = (dim+MBSIZE_C-1)/MBSIZE_C * MBSIZE_C;
00517
00518 CudaNLCP_FullKernel_V2_kernel<double><<< grid, threads,0>>>(dim,dim_n,dim_n*itMax,tol,mu,(const double *) m,mP,(const double *) q,(double *) f,(double *) err,(int *) share);
00519
00520 #endif
00521 }