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

Function main

cpp/5_Domain_Specific/postProcessGL/main.cpp:738–784  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

736// Program main
737////////////////////////////////////////////////////////////////////////////////
738int main(int argc, char **argv)
739{
740#if defined(__linux__)
741 char *Xstatus = getenv("DISPLAY");
742 if (Xstatus == NULL) {
743 printf("Waiving execution as X server is not running\n");
744 exit(EXIT_WAIVED);
745 }
746 setenv("DISPLAY", ":0", 0);
747#endif
748
749 printf("%s Starting...\n\n", argv[0]);
750
751 if (checkCmdLineFlag(argc, (const char **)argv, "radius") && checkCmdLineFlag(argc, (const char **)argv, "file")) {
752 getCmdLineArgumentString(argc, (const char **)argv, "file", &ref_file);
753 blur_radius = getCmdLineArgumentInt(argc, (const char **)argv, "radius");
754 }
755
756 pArgc = &argc;
757 pArgv = argv;
758
759 // use command-line specified CUDA device, otherwise use device with highest
760 // Gflops/s
761 if (checkCmdLineFlag(argc, (const char **)argv, "device")) {
762 printf("[%s]\n", argv[0]);
763 printf(" Does not explicitly support -device=n\n");
764 printf(" This sample requires OpenGL. Only -file=<reference> -radius=<n> "
765 "are supported\n");
766 printf("exiting...\n");
767 exit(EXIT_WAIVED);
768 }
769
770 if (ref_file) {
771 printf("(Test with OpenGL verification)\n");
772 animate = false;
773
774 runStdProgram(argc, argv);
775 }
776 else {
777 printf("(Interactive OpenGL Demo)\n");
778 animate = true;
779
780 runStdProgram(argc, argv);
781 }
782
783 exit(EXIT_SUCCESS);
784}
785
786////////////////////////////////////////////////////////////////////////////////
787//!

Callers

nothing calls this directly

Calls 4

checkCmdLineFlagFunction · 0.85
getCmdLineArgumentStringFunction · 0.85
getCmdLineArgumentIntFunction · 0.85
runStdProgramFunction · 0.70

Tested by

no test coverage detected