/normxcorr/trunk

To get this branch, use:
bzr branch http://suren.me/webbzr/normxcorr/trunk

« back to all changes in this revision

Viewing changes to dict_hw/src/dict_hw_test.cpp

  • Committer: Suren A. Chilingaryan
  • Date: 2010-04-25 04:39:54 UTC
  • Revision ID: csa@dside.dyndns.org-20100425043954-v7xm2bzohickyl9z
Multi-GPU support

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
typedef enum {
27
27
    OPT_DEFAULT_FFT = 250,
 
28
    OPT_SINGLE_MODE = 251,
28
29
    OPT_MATLAB = 'm',
29
30
    OPT_HELP = 'h'
30
31
} Options;
32
33
static struct option long_options[] = {
33
34
    {"matlab",                  no_argument, 0, OPT_MATLAB },
34
35
    {"default-fft",             no_argument, 0, OPT_DEFAULT_FFT },
 
36
    {"no-threads",              no_argument, 0, OPT_SINGLE_MODE },
35
37
    {"help",                    no_argument, 0, OPT_HELP },
36
38
    { 0, 0, 0, 0 }
37
39
};
42
44
"  Modes:\n"
43
45
"       --matlab        - Matlab mode (transposed data ordering)\n"
44
46
"       --default-fft   - Do not optimize FFT size\n"
 
47
"       --no-threads    - Single GPU mode\n"
45
48
"       --help          - Help message\n"
46
49
"\n\n", argv[0]);
47
50
}
149
152
#endif /* DICT_HW_MEASURE_TIMINGS */
150
153
 
151
154
    int default_fft = 0;
 
155
    int single_mode = 0;
152
156
    
153
157
    int option_index = 0;
154
158
    unsigned char c;
162
166
            case OPT_DEFAULT_FFT:
163
167
                default_fft = 1;
164
168
            break;
 
169
            case OPT_SINGLE_MODE:
 
170
                single_mode = 1;
 
171
            break;
165
172
            case OPT_HELP:
166
173
                Usage(argc, argv);
167
174
                exit(0);                
246
253
    int ncp = xsize;
247
254
    
248
255
    DICTContext ps = dictCreateContext();
 
256
    if (!ps) {
 
257
        printf("Context intialization is failed, no CUDA-devices...\n");
 
258
        exit(-1);
 
259
    }
249
260
 
250
261
    flags = DICT_FLAGS_DEFAULT;
251
262
    if (matlab_mode) flags |= DICT_FLAGS_MATLAB_MODE;
252
263
    if (default_fft) flags |= DICT_FLAGS_FIXED_FFT_SIZE;
 
264
    if (single_mode) flags |= DICT_FLAGS_SINGLE_THREAD;
253
265
 
254
266
    err = dictSetup(ps, ncp, 15, 1000, flags);
255
267
    
343
355
        g_free(name);
344
356
 
345
357
        if (err) {
346
 
            printf("failed to load template file %s\n", images[0]);
 
358
            printf("failed to load image %s\n", images[0]);
347
359
            exit(-1);
348
360
        }
349
361