| 727 | } |
| 728 | |
| 729 | int32_t main(int32_t argc, char** argv) |
| 730 | { |
| 731 | samplesCommon::Args args; |
| 732 | bool argsOK = samplesCommon::parseArgs(args, argc, argv); |
| 733 | if (!argsOK) |
| 734 | { |
| 735 | sample::gLogError << "Invalid arguments" << std::endl; |
| 736 | printHelpInfo(); |
| 737 | return EXIT_FAILURE; |
| 738 | } |
| 739 | if (args.help) |
| 740 | { |
| 741 | printHelpInfo(); |
| 742 | return EXIT_SUCCESS; |
| 743 | } |
| 744 | |
| 745 | auto sampleTest = sample::Logger::defineTest(gSampleName, argc, argv); |
| 746 | |
| 747 | sample::Logger::reportTestStart(sampleTest); |
| 748 | |
| 749 | samplesCommon::OnnxSampleParams params = initializeSampleParams(args); |
| 750 | |
| 751 | // Write Algorithm Cache. |
| 752 | SampleAlgorithmSelector sampleAlgorithmSelector(params); |
| 753 | |
| 754 | { |
| 755 | sample::gLogInfo << "Building and running a GPU inference engine for MNIST." << std::endl; |
| 756 | sample::gLogInfo << "Writing Algorithm Cache for MNIST." << std::endl; |
| 757 | AlgorithmCacheWriter algorithmCacheWriter(gCacheFileName); |
| 758 | |
| 759 | if (!sampleAlgorithmSelector.build(&algorithmCacheWriter)) |
| 760 | { |
| 761 | return sample::Logger::reportFail(sampleTest); |
| 762 | } |
| 763 | |
| 764 | if (!sampleAlgorithmSelector.infer()) |
| 765 | { |
| 766 | return sample::Logger::reportFail(sampleTest); |
| 767 | } |
| 768 | } |
| 769 | |
| 770 | { |
| 771 | // Build network using Cache from previous run. |
| 772 | sample::gLogInfo << "Building a GPU inference engine for MNIST using Algorithm Cache." << std::endl; |
| 773 | AlgorithmCacheReader algorithmCacheReader(gCacheFileName); |
| 774 | |
| 775 | if (!sampleAlgorithmSelector.build(&algorithmCacheReader)) |
| 776 | { |
| 777 | return sample::Logger::reportFail(sampleTest); |
| 778 | } |
| 779 | |
| 780 | if (!sampleAlgorithmSelector.infer()) |
| 781 | { |
| 782 | return sample::Logger::reportFail(sampleTest); |
| 783 | } |
| 784 | } |
| 785 | |
| 786 | { |
nothing calls this directly
no test coverage detected