-
Notifications
You must be signed in to change notification settings - Fork 286
/
cudaSiftH.cu
515 lines (484 loc) · 17.9 KB
/
cudaSiftH.cu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
//********************************************************//
// CUDA SIFT extractor by Mårten Björkman aka Celebrandil //
//********************************************************//
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include "cudautils.h"
#include "cudaImage.h"
#include "cudaSift.h"
#include "cudaSiftD.h"
#include "cudaSiftH.h"
#include "cudaSiftD.cu"
void InitCuda(int devNum)
{
int nDevices;
cudaGetDeviceCount(&nDevices);
if (!nDevices) {
std::cerr << "No CUDA devices available" << std::endl;
return;
}
devNum = std::min(nDevices-1, devNum);
deviceInit(devNum);
cudaDeviceProp prop;
cudaGetDeviceProperties(&prop, devNum);
printf("Device Number: %d\n", devNum);
printf(" Device name: %s\n", prop.name);
printf(" Memory Clock Rate (MHz): %d\n", prop.memoryClockRate/1000);
printf(" Memory Bus Width (bits): %d\n", prop.memoryBusWidth);
printf(" Peak Memory Bandwidth (GB/s): %.1f\n\n",
2.0*prop.memoryClockRate*(prop.memoryBusWidth/8)/1.0e6);
}
float *AllocSiftTempMemory(int width, int height, int numOctaves, bool scaleUp)
{
TimerGPU timer(0);
const int nd = NUM_SCALES + 3;
int w = width*(scaleUp ? 2 : 1);
int h = height*(scaleUp ? 2 : 1);
int p = iAlignUp(w, 128);
int size = h*p; // image sizes
int sizeTmp = nd*h*p; // laplace buffer sizes
for (int i=0;i<numOctaves;i++) {
w /= 2;
h /= 2;
int p = iAlignUp(w, 128);
size += h*p;
sizeTmp += nd*h*p;
}
float *memoryTmp = NULL;
size_t pitch;
size += sizeTmp;
safeCall(cudaMallocPitch((void **)&memoryTmp, &pitch, (size_t)4096, (size+4095)/4096*sizeof(float)));
#ifdef VERBOSE
printf("Allocated memory size: %d bytes\n", size);
printf("Memory allocation time = %.2f ms\n\n", timer.read());
#endif
return memoryTmp;
}
void FreeSiftTempMemory(float *memoryTmp)
{
if (memoryTmp)
safeCall(cudaFree(memoryTmp));
}
void ExtractSift(SiftData &siftData, CudaImage &img, int numOctaves, double initBlur, float thresh, float lowestScale, bool scaleUp, float *tempMemory)
{
TimerGPU timer(0);
unsigned int *d_PointCounterAddr;
safeCall(cudaGetSymbolAddress((void**)&d_PointCounterAddr, d_PointCounter));
safeCall(cudaMemset(d_PointCounterAddr, 0, (8*2+1)*sizeof(int)));
safeCall(cudaMemcpyToSymbol(d_MaxNumPoints, &siftData.maxPts, sizeof(int)));
const int nd = NUM_SCALES + 3;
int w = img.width*(scaleUp ? 2 : 1);
int h = img.height*(scaleUp ? 2 : 1);
int p = iAlignUp(w, 128);
int width = w, height = h;
int size = h*p; // image sizes
int sizeTmp = nd*h*p; // laplace buffer sizes
for (int i=0;i<numOctaves;i++) {
w /= 2;
h /= 2;
int p = iAlignUp(w, 128);
size += h*p;
sizeTmp += nd*h*p;
}
float *memoryTmp = tempMemory;
size += sizeTmp;
if (!tempMemory) {
size_t pitch;
safeCall(cudaMallocPitch((void **)&memoryTmp, &pitch, (size_t)4096, (size+4095)/4096*sizeof(float)));
#ifdef VERBOSE
printf("Allocated memory size: %d bytes\n", size);
printf("Memory allocation time = %.2f ms\n\n", timer.read());
#endif
}
float *memorySub = memoryTmp + sizeTmp;
CudaImage lowImg;
lowImg.Allocate(width, height, iAlignUp(width, 128), false, memorySub);
if (!scaleUp) {
float kernel[8*12*16];
PrepareLaplaceKernels(numOctaves, 0.0f, kernel);
safeCall(cudaMemcpyToSymbolAsync(d_LaplaceKernel, kernel, 8*12*16*sizeof(float)));
LowPass(lowImg, img, max(initBlur, 0.001f));
TimerGPU timer1(0);
ExtractSiftLoop(siftData, lowImg, numOctaves, 0.0f, thresh, lowestScale, 1.0f, memoryTmp, memorySub + height*iAlignUp(width, 128));
safeCall(cudaMemcpy(&siftData.numPts, &d_PointCounterAddr[2*numOctaves], sizeof(int), cudaMemcpyDeviceToHost));
siftData.numPts = (siftData.numPts<siftData.maxPts ? siftData.numPts : siftData.maxPts);
printf("SIFT extraction time = %.2f ms %d\n", timer1.read(), siftData.numPts);
} else {
CudaImage upImg;
upImg.Allocate(width, height, iAlignUp(width, 128), false, memoryTmp);
TimerGPU timer1(0);
ScaleUp(upImg, img);
LowPass(lowImg, upImg, max(initBlur, 0.001f));
float kernel[8*12*16];
PrepareLaplaceKernels(numOctaves, 0.0f, kernel);
safeCall(cudaMemcpyToSymbolAsync(d_LaplaceKernel, kernel, 8*12*16*sizeof(float)));
ExtractSiftLoop(siftData, lowImg, numOctaves, 0.0f, thresh, lowestScale*2.0f, 1.0f, memoryTmp, memorySub + height*iAlignUp(width, 128));
safeCall(cudaMemcpy(&siftData.numPts, &d_PointCounterAddr[2*numOctaves], sizeof(int), cudaMemcpyDeviceToHost));
siftData.numPts = (siftData.numPts<siftData.maxPts ? siftData.numPts : siftData.maxPts);
RescalePositions(siftData, 0.5f);
printf("SIFT extraction time = %.2f ms\n", timer1.read());
}
if (!tempMemory)
safeCall(cudaFree(memoryTmp));
#ifdef MANAGEDMEM
safeCall(cudaDeviceSynchronize());
#else
if (siftData.h_data)
safeCall(cudaMemcpy(siftData.h_data, siftData.d_data, sizeof(SiftPoint)*siftData.numPts, cudaMemcpyDeviceToHost));
#endif
double totTime = timer.read();
printf("Incl prefiltering & memcpy = %.2f ms %d\n\n", totTime, siftData.numPts);
}
int ExtractSiftLoop(SiftData &siftData, CudaImage &img, int numOctaves, double initBlur, float thresh, float lowestScale, float subsampling, float *memoryTmp, float *memorySub)
{
#ifdef VERBOSE
TimerGPU timer(0);
#endif
int w = img.width;
int h = img.height;
if (numOctaves>1) {
CudaImage subImg;
int p = iAlignUp(w/2, 128);
subImg.Allocate(w/2, h/2, p, false, memorySub);
ScaleDown(subImg, img, 0.5f);
float totInitBlur = (float)sqrt(initBlur*initBlur + 0.5f*0.5f) / 2.0f;
ExtractSiftLoop(siftData, subImg, numOctaves-1, totInitBlur, thresh, lowestScale, subsampling*2.0f, memoryTmp, memorySub + (h/2)*p);
}
ExtractSiftOctave(siftData, img, numOctaves, thresh, lowestScale, subsampling, memoryTmp);
#ifdef VERBOSE
double totTime = timer.read();
printf("ExtractSift time total = %.2f ms %d\n\n", totTime, numOctaves);
#endif
return 0;
}
void ExtractSiftOctave(SiftData &siftData, CudaImage &img, int octave, float thresh, float lowestScale, float subsampling, float *memoryTmp)
{
const int nd = NUM_SCALES + 3;
#ifdef VERBOSE
unsigned int *d_PointCounterAddr;
safeCall(cudaGetSymbolAddress((void**)&d_PointCounterAddr, d_PointCounter));
unsigned int fstPts, totPts;
safeCall(cudaMemcpy(&fstPts, &d_PointCounterAddr[2*octave-1], sizeof(int), cudaMemcpyDeviceToHost));
TimerGPU timer0;
#endif
CudaImage diffImg[nd];
int w = img.width;
int h = img.height;
int p = iAlignUp(w, 128);
for (int i=0;i<nd-1;i++)
diffImg[i].Allocate(w, h, p, false, memoryTmp + i*p*h);
// Specify texture
struct cudaResourceDesc resDesc;
memset(&resDesc, 0, sizeof(resDesc));
resDesc.resType = cudaResourceTypePitch2D;
resDesc.res.pitch2D.devPtr = img.d_data;
resDesc.res.pitch2D.width = img.width;
resDesc.res.pitch2D.height = img.height;
resDesc.res.pitch2D.pitchInBytes = img.pitch*sizeof(float);
resDesc.res.pitch2D.desc = cudaCreateChannelDesc<float>();
// Specify texture object parameters
struct cudaTextureDesc texDesc;
memset(&texDesc, 0, sizeof(texDesc));
texDesc.addressMode[0] = cudaAddressModeClamp;
texDesc.addressMode[1] = cudaAddressModeClamp;
texDesc.filterMode = cudaFilterModeLinear;
texDesc.readMode = cudaReadModeElementType;
texDesc.normalizedCoords = 0;
// Create texture object
cudaTextureObject_t texObj = 0;
cudaCreateTextureObject(&texObj, &resDesc, &texDesc, NULL);
#ifdef VERBOSE
TimerGPU timer1;
#endif
float baseBlur = pow(2.0f, -1.0f/NUM_SCALES);
float diffScale = pow(2.0f, 1.0f/NUM_SCALES);
LaplaceMulti(texObj, img, diffImg, octave);
FindPointsMulti(diffImg, siftData, thresh, 10.0f, 1.0f/NUM_SCALES, lowestScale/subsampling, subsampling, octave);
#ifdef VERBOSE
double gpuTimeDoG = timer1.read();
TimerGPU timer4;
#endif
ComputeOrientations(texObj, img, siftData, octave);
ExtractSiftDescriptors(texObj, siftData, subsampling, octave);
//OrientAndExtract(texObj, siftData, subsampling, octave);
safeCall(cudaDestroyTextureObject(texObj));
#ifdef VERBOSE
double gpuTimeSift = timer4.read();
double totTime = timer0.read();
printf("GPU time : %.2f ms + %.2f ms + %.2f ms = %.2f ms\n", totTime-gpuTimeDoG-gpuTimeSift, gpuTimeDoG, gpuTimeSift, totTime);
safeCall(cudaMemcpy(&totPts, &d_PointCounterAddr[2*octave+1], sizeof(int), cudaMemcpyDeviceToHost));
totPts = (totPts<siftData.maxPts ? totPts : siftData.maxPts);
if (totPts>0)
printf(" %.2f ms / DoG, %.4f ms / Sift, #Sift = %d\n", gpuTimeDoG/NUM_SCALES, gpuTimeSift/(totPts-fstPts), totPts-fstPts);
#endif
}
void InitSiftData(SiftData &data, int num, bool host, bool dev)
{
data.numPts = 0;
data.maxPts = num;
int sz = sizeof(SiftPoint)*num;
#ifdef MANAGEDMEM
safeCall(cudaMallocManaged((void **)&data.m_data, sz));
#else
data.h_data = NULL;
if (host)
data.h_data = (SiftPoint *)malloc(sz);
data.d_data = NULL;
if (dev)
safeCall(cudaMalloc((void **)&data.d_data, sz));
#endif
}
void FreeSiftData(SiftData &data)
{
#ifdef MANAGEDMEM
safeCall(cudaFree(data.m_data));
#else
if (data.d_data!=NULL)
safeCall(cudaFree(data.d_data));
data.d_data = NULL;
if (data.h_data!=NULL)
free(data.h_data);
#endif
data.numPts = 0;
data.maxPts = 0;
}
void PrintSiftData(SiftData &data)
{
#ifdef MANAGEDMEM
SiftPoint *h_data = data.m_data;
#else
SiftPoint *h_data = data.h_data;
if (data.h_data==NULL) {
h_data = (SiftPoint *)malloc(sizeof(SiftPoint)*data.maxPts);
safeCall(cudaMemcpy(h_data, data.d_data, sizeof(SiftPoint)*data.numPts, cudaMemcpyDeviceToHost));
data.h_data = h_data;
}
#endif
for (int i=0;i<data.numPts;i++) {
printf("xpos = %.2f\n", h_data[i].xpos);
printf("ypos = %.2f\n", h_data[i].ypos);
printf("scale = %.2f\n", h_data[i].scale);
printf("sharpness = %.2f\n", h_data[i].sharpness);
printf("edgeness = %.2f\n", h_data[i].edgeness);
printf("orientation = %.2f\n", h_data[i].orientation);
printf("score = %.2f\n", h_data[i].score);
float *siftData = (float*)&h_data[i].data;
for (int j=0;j<8;j++) {
if (j==0)
printf("data = ");
else
printf(" ");
for (int k=0;k<16;k++)
if (siftData[j+8*k]<0.05)
printf(" . ");
else
printf("%.2f ", siftData[j+8*k]);
printf("\n");
}
}
printf("Number of available points: %d\n", data.numPts);
printf("Number of allocated points: %d\n", data.maxPts);
}
///////////////////////////////////////////////////////////////////////////////
// Host side master functions
///////////////////////////////////////////////////////////////////////////////
double ScaleDown(CudaImage &res, CudaImage &src, float variance)
{
static float oldVariance = -1.0f;
if (res.d_data==NULL || src.d_data==NULL) {
printf("ScaleDown: missing data\n");
return 0.0;
}
if (oldVariance!=variance) {
float h_Kernel[5];
float kernelSum = 0.0f;
for (int j=0;j<5;j++) {
h_Kernel[j] = (float)expf(-(double)(j-2)*(j-2)/2.0/variance);
kernelSum += h_Kernel[j];
}
for (int j=0;j<5;j++)
h_Kernel[j] /= kernelSum;
safeCall(cudaMemcpyToSymbol(d_ScaleDownKernel, h_Kernel, 5*sizeof(float)));
oldVariance = variance;
}
#if 0
dim3 blocks(iDivUp(src.width, SCALEDOWN_W), iDivUp(src.height, SCALEDOWN_H));
dim3 threads(SCALEDOWN_W + 4, SCALEDOWN_H + 4);
ScaleDownDenseShift<<<blocks, threads>>>(res.d_data, src.d_data, src.width, src.pitch, src.height, res.pitch);
#else
dim3 blocks(iDivUp(src.width, SCALEDOWN_W), iDivUp(src.height, SCALEDOWN_H));
dim3 threads(SCALEDOWN_W + 4);
ScaleDown<<<blocks, threads>>>(res.d_data, src.d_data, src.width, src.pitch, src.height, res.pitch);
#endif
checkMsg("ScaleDown() execution failed\n");
return 0.0;
}
double ScaleUp(CudaImage &res, CudaImage &src)
{
if (res.d_data==NULL || src.d_data==NULL) {
printf("ScaleUp: missing data\n");
return 0.0;
}
dim3 blocks(iDivUp(res.width, SCALEUP_W), iDivUp(res.height, SCALEUP_H));
dim3 threads(SCALEUP_W/2, SCALEUP_H/2);
ScaleUp<<<blocks, threads>>>(res.d_data, src.d_data, src.width, src.pitch, src.height, res.pitch);
checkMsg("ScaleUp() execution failed\n");
return 0.0;
}
double ComputeOrientations(cudaTextureObject_t texObj, CudaImage &src, SiftData &siftData, int octave)
{
dim3 blocks(512);
#ifdef MANAGEDMEM
ComputeOrientationsCONST<<<blocks, threads>>>(texObj, siftData.m_data, octave);
#else
#if 1
dim3 threads(11*11);
ComputeOrientationsCONST<<<blocks, threads>>>(texObj, siftData.d_data, octave);
#else
dim3 threads(256);
ComputeOrientationsCONSTNew<<<blocks, threads>>>(src.d_data, src.width, src.pitch, src.height, siftData.d_data, octave);
#endif
#endif
checkMsg("ComputeOrientations() execution failed\n");
return 0.0;
}
double ExtractSiftDescriptors(cudaTextureObject_t texObj, SiftData &siftData, float subsampling, int octave)
{
dim3 blocks(512);
dim3 threads(16, 8);
#ifdef MANAGEDMEM
ExtractSiftDescriptorsCONST<<<blocks, threads>>>(texObj, siftData.m_data, subsampling, octave);
#else
ExtractSiftDescriptorsCONSTNew<<<blocks, threads>>>(texObj, siftData.d_data, subsampling, octave);
#endif
checkMsg("ExtractSiftDescriptors() execution failed\n");
return 0.0;
}
double OrientAndExtract(cudaTextureObject_t texObj, SiftData &siftData, float subsampling, int octave)
{
dim3 blocks(256);
dim3 threads(128);
#ifdef MANAGEDMEM
OrientAndExtractCONST<<<blocks, threads>>>(texObj, siftData.m_data, subsampling, octave);
#else
OrientAndExtractCONST<<<blocks, threads>>>(texObj, siftData.d_data, subsampling, octave);
#endif
checkMsg("OrientAndExtract() execution failed\n");
return 0.0;
}
double RescalePositions(SiftData &siftData, float scale)
{
dim3 blocks(iDivUp(siftData.numPts, 64));
dim3 threads(64);
RescalePositions<<<blocks, threads>>>(siftData.d_data, siftData.numPts, scale);
checkMsg("RescapePositions() execution failed\n");
return 0.0;
}
double LowPass(CudaImage &res, CudaImage &src, float scale)
{
float kernel[2*LOWPASS_R+1];
static float oldScale = -1.0f;
if (scale!=oldScale) {
float kernelSum = 0.0f;
float ivar2 = 1.0f/(2.0f*scale*scale);
for (int j=-LOWPASS_R;j<=LOWPASS_R;j++) {
kernel[j+LOWPASS_R] = (float)expf(-(double)j*j*ivar2);
kernelSum += kernel[j+LOWPASS_R];
}
for (int j=-LOWPASS_R;j<=LOWPASS_R;j++)
kernel[j+LOWPASS_R] /= kernelSum;
safeCall(cudaMemcpyToSymbol(d_LowPassKernel, kernel, (2*LOWPASS_R+1)*sizeof(float)));
oldScale = scale;
}
int width = res.width;
int pitch = res.pitch;
int height = res.height;
dim3 blocks(iDivUp(width, LOWPASS_W), iDivUp(height, LOWPASS_H));
#if 1
dim3 threads(LOWPASS_W+2*LOWPASS_R, 4);
LowPassBlock<<<blocks, threads>>>(src.d_data, res.d_data, width, pitch, height);
#else
dim3 threads(LOWPASS_W+2*LOWPASS_R, LOWPASS_H);
LowPass<<<blocks, threads>>>(src.d_data, res.d_data, width, pitch, height);
#endif
checkMsg("LowPass() execution failed\n");
return 0.0;
}
//==================== Multi-scale functions ===================//
void PrepareLaplaceKernels(int numOctaves, float initBlur, float *kernel)
{
if (numOctaves>1) {
float totInitBlur = (float)sqrt(initBlur*initBlur + 0.5f*0.5f) / 2.0f;
PrepareLaplaceKernels(numOctaves-1, totInitBlur, kernel);
}
float scale = pow(2.0f, -1.0f/NUM_SCALES);
float diffScale = pow(2.0f, 1.0f/NUM_SCALES);
for (int i=0;i<NUM_SCALES+3;i++) {
float kernelSum = 0.0f;
float var = scale*scale - initBlur*initBlur;
for (int j=0;j<=LAPLACE_R;j++) {
kernel[numOctaves*12*16 + 16*i + j] = (float)expf(-(double)j*j/2.0/var);
kernelSum += (j==0 ? 1 : 2)*kernel[numOctaves*12*16 + 16*i + j];
}
for (int j=0;j<=LAPLACE_R;j++)
kernel[numOctaves*12*16 + 16*i + j] /= kernelSum;
scale *= diffScale;
}
}
double LaplaceMulti(cudaTextureObject_t texObj, CudaImage &baseImage, CudaImage *results, int octave)
{
int width = results[0].width;
int pitch = results[0].pitch;
int height = results[0].height;
#if 1
dim3 threads(LAPLACE_W+2*LAPLACE_R);
dim3 blocks(iDivUp(width, LAPLACE_W), height);
LaplaceMultiMem<<<blocks, threads>>>(baseImage.d_data, results[0].d_data, width, pitch, height, octave);
#endif
#if 0
dim3 threads(LAPLACE_W+2*LAPLACE_R, LAPLACE_S);
dim3 blocks(iDivUp(width, LAPLACE_W), iDivUp(height, LAPLACE_H));
LaplaceMultiMemTest<<<blocks, threads>>>(baseImage.d_data, results[0].d_data, width, pitch, height, octave);
#endif
#if 0
dim3 threads(LAPLACE_W+2*LAPLACE_R, LAPLACE_S);
dim3 blocks(iDivUp(width, LAPLACE_W), height);
LaplaceMultiMemOld<<<blocks, threads>>>(baseImage.d_data, results[0].d_data, width, pitch, height, octave);
#endif
#if 0
dim3 threads(LAPLACE_W+2*LAPLACE_R, LAPLACE_S);
dim3 blocks(iDivUp(width, LAPLACE_W), height);
LaplaceMultiTex<<<blocks, threads>>>(texObj, results[0].d_data, width, pitch, height, octave);
#endif
checkMsg("LaplaceMulti() execution failed\n");
return 0.0;
}
double FindPointsMulti(CudaImage *sources, SiftData &siftData, float thresh, float edgeLimit, float factor, float lowestScale, float subsampling, int octave)
{
if (sources->d_data==NULL) {
printf("FindPointsMulti: missing data\n");
return 0.0;
}
int w = sources->width;
int p = sources->pitch;
int h = sources->height;
#if 0
dim3 blocks(iDivUp(w, MINMAX_W)*NUM_SCALES, iDivUp(h, MINMAX_H));
dim3 threads(MINMAX_W + 2, MINMAX_H);
FindPointsMultiTest<<<blocks, threads>>>(sources->d_data, siftData.d_data, w, p, h, subsampling, lowestScale, thresh, factor, edgeLimit, octave);
#endif
#if 1
dim3 blocks(iDivUp(w, MINMAX_W)*NUM_SCALES, iDivUp(h, MINMAX_H));
dim3 threads(MINMAX_W + 2);
#ifdef MANAGEDMEM
FindPointsMulti<<<blocks, threads>>>(sources->d_data, siftData.m_data, w, p, h, subsampling, lowestScale, thresh, factor, edgeLimit, octave);
#else
FindPointsMultiNew<<<blocks, threads>>>(sources->d_data, siftData.d_data, w, p, h, subsampling, lowestScale, thresh, factor, edgeLimit, octave);
#endif
#endif
checkMsg("FindPointsMulti() execution failed\n");
return 0.0;
}