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

Function main

cpp/0_Introduction/simpleCUDA2GL/main.cpp:462–503  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

460// Program main
461////////////////////////////////////////////////////////////////////////////////
462int main(int argc, char **argv)
463{
464#if defined(__linux__)
465 char *Xstatus = getenv("DISPLAY");
466 if (Xstatus == NULL) {
467 printf("Waiving execution as X server is not running\n");
468 exit(EXIT_WAIVED);
469 }
470 setenv("DISPLAY", ":0", 0);
471#endif
472
473 printf("%s Starting...\n\n", argv[0]);
474
475 if (checkCmdLineFlag(argc, (const char **)argv, "file")) {
476 getCmdLineArgumentString(argc, (const char **)argv, "file", &ref_file);
477 }
478
479 pArgc = &argc;
480 pArgv = argv;
481
482 // use command-line specified CUDA device, otherwise use device with highest
483 // Gflops/s
484 if (checkCmdLineFlag(argc, (const char **)argv, "device")) {
485 printf("[%s]\n", argv[0]);
486 printf(" Does not explicitly support -device=n\n");
487 printf(" This sample requires OpenGL. Only -file=<reference> are "
488 "supported\n");
489 printf("exiting...\n");
490 exit(EXIT_WAIVED);
491 }
492
493 if (ref_file) {
494 printf("(Test with OpenGL verification)\n");
495 runStdProgram(argc, argv);
496 }
497 else {
498 printf("(Interactive OpenGL Demo)\n");
499 runStdProgram(argc, argv);
500 }
501
502 exit(EXIT_SUCCESS);
503}
504
505////////////////////////////////////////////////////////////////////////////////
506//!

Callers

nothing calls this directly

Calls 3

checkCmdLineFlagFunction · 0.85
getCmdLineArgumentStringFunction · 0.85
runStdProgramFunction · 0.70

Tested by

no test coverage detected