34
36
{"matlab", no_argument, 0, OPT_MATLAB },
35
37
{"default-fft", no_argument, 0, OPT_DEFAULT_FFT },
36
38
{"no-threads", no_argument, 0, OPT_SINGLE_MODE },
39
{"no-preload", no_argument, 0, OPT_NO_PRELOAD },
40
{"multipass", no_argument, 0, OPT_MULTIPASS },
37
41
{"help", no_argument, 0, OPT_HELP },
41
45
void Usage(int argc, char *argv[]) {
43
" %s [options] [mode] <directory> [maximages]\n"
47
" %s [options] <directory> [maximages]\n"
45
49
" --matlab - Matlab mode (transposed data ordering)\n"
46
50
" --default-fft - Do not optimize FFT size\n"
47
" --no-threads - Single GPU mode\n"
51
" --no-threads - Disables threading, results in a single GPU mode\n"
52
" --no-preload - Disables image preloading in multi-threaded mode\n"
53
" --multipass - In multipass mode the caching is always used at the\n"
54
" expense of the repeated image reading\n"
48
55
" --help - Help message\n"
244
261
if ((!maximg)||(maximg > i)) maximg = i;
246
qsort(images, allocimg, sizeof(char*), (int (*)(const void*, const void*))compare);
248
263
if (maximg < 2) {
249
264
printf("At least two images are required\n");
268
qsort(images, allocimg, sizeof(char*), (int (*)(const void*, const void*))compare);
255
272
DICTContext ps = dictCreateContext();
332
349
#endif /* DICT_HW_MEASURE_TIMINGS */
335
for (i = 1; i < maximg; i++) {
354
name = g_strdup_printf("%s/images/%s", argv[optind], images[1]);
355
if (!g_file_test(name, G_FILE_TEST_IS_REGULAR)) {
357
printf("%s is not a regular file\n", images[1]);
361
for (i = 1; i < maximg; i++, name = next) {
336
362
#ifndef DICT_HW_MEASURE_TIMINGS
337
363
printf("%s\n", images[i]);
338
364
#endif /* !DICT_HW_MEASURE_TIMINGS */
367
if ((i + 1) < maximg) {
368
next = g_strdup_printf("%s/images/%s", argv[optind], images[i + 1]);
369
if (!g_file_test(next, G_FILE_TEST_IS_REGULAR)) {
372
printf("%s is not a regular file\n", images[i + 1]);
377
dictPreloadImageFile(ps, next);
340
name = g_strdup_printf("%s/images/%s", argv[optind], images[i]);
341
if (!g_file_test(name, G_FILE_TEST_IS_REGULAR)) {
343
printf("%s is not a regular file\n", images[0]);
347
381
#ifdef DICT_HW_MEASURE_TIMINGS
348
382
gettimeofday(&tv3, NULL);
349
383
#endif /* DICT_HW_MEASURE_TIMINGS */
352
386
gettimeofday(&tv2, NULL);
353
387
time[5] += (tv2.tv_sec - tv3.tv_sec) * 1000000 + (tv2.tv_usec - tv3.tv_usec);
354
388
#endif /* DICT_HW_MEASURE_TIMINGS */
358
393
printf("failed to load image %s\n", images[0]);
362
398
if (matlab_mode) {
363
399
float *out = res + ncp * (i - 1);