MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / main

Function main

cpp/5_Domain_Specific/recursiveGaussian/recursiveGaussian.cpp:428–530  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////////// Program main ///////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

426// Program main
427////////////////////////////////////////////////////////////////////////////////
428int main(int argc, char **argv)
429{
430 pArgc = &argc;
431 pArgv = argv;
432 char *ref_file = NULL;
433
434#if defined(__linux__)
435 setenv("DISPLAY", ":0", 0);
436#endif
437
438 printf("%s Starting...\n\n", sSDKsample);
439
440 printf("NOTE: The CUDA Samples are not meant for performance measurements. "
441 "Results may vary when GPU Boost is enabled.\n\n");
442
443 // use command-line specified CUDA device, otherwise use device with highest
444 // Gflops/s
445 if (argc > 1) {
446 if (checkCmdLineFlag(argc, (const char **)argv, "file")) {
447 getCmdLineArgumentString(argc, (const char **)argv, "file", &ref_file);
448 fpsLimit = frameCheckNumber;
449 }
450 }
451
452 // Get the path of the filename
453 char *filename;
454
455 if (getCmdLineArgumentString(argc, (const char **)argv, "image", &filename)) {
456 image_filename = filename;
457 }
458
459 // load image
460 char *image_path = sdkFindFilePath(image_filename, argv[0]);
461
462 if (image_path == NULL) {
463 fprintf(stderr, "Error unable to find and load image file: '%s'\n", image_filename);
464 exit(EXIT_FAILURE);
465 }
466
467 sdkLoadPPM4ub(image_path, (unsigned char **)&h_img, &width, &height);
468
469 if (!h_img) {
470 printf("Error unable to load PPM file: '%s'\n", image_path);
471 exit(EXIT_FAILURE);
472 }
473
474 printf("Loaded '%s', %d x %d pixels\n", image_path, width, height);
475
476 if (checkCmdLineFlag(argc, (const char **)argv, "threads")) {
477 nthreads = getCmdLineArgumentInt(argc, (const char **)argv, "threads");
478 }
479
480 if (checkCmdLineFlag(argc, (const char **)argv, "sigma")) {
481 sigma = getCmdLineArgumentFloat(argc, (const char **)argv, "sigma");
482 }
483
484 runBenchmark = checkCmdLineFlag(argc, (const char **)argv, "benchmark");
485

Callers

nothing calls this directly

Calls 13

checkCmdLineFlagFunction · 0.85
getCmdLineArgumentStringFunction · 0.85
sdkFindFilePathFunction · 0.85
sdkLoadPPM4ubFunction · 0.85
getCmdLineArgumentIntFunction · 0.85
getCmdLineArgumentFloatFunction · 0.85
findCudaDeviceFunction · 0.85
initCudaBuffersFunction · 0.85
benchmarkFunction · 0.85
initGLFunction · 0.70
runSingleTestFunction · 0.70
cleanupFunction · 0.70

Tested by

no test coverage detected