MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / main

Function main

samples/trtexec/trtexec.cpp:281–566  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279using duration = std::chrono::duration<float>;
280
281int main(int argc, char** argv)
282{
283 std::string const sampleName = "TensorRT.trtexec";
284
285 auto sampleTest = sample::gLogger.defineTest(sampleName, argc, argv);
286
287 try
288 {
289 sample::gLogger.reportTestStart(sampleTest);
290
291 Arguments args = argsToArgumentsMap(argc, argv);
292 AllOptions options;
293
294 if (parseHelp(args))
295 {
296 AllOptions::help(std::cout);
297 return EXIT_SUCCESS;
298 }
299
300 if (!args.empty())
301 {
302 bool failed{false};
303 try
304 {
305 options.parse(args);
306
307 if (!args.empty())
308 {
309 for (auto const& arg : args)
310 {
311 sample::gLogError << "Unknown option: " << arg.first << " " << arg.second << std::endl;
312 }
313 failed = true;
314 }
315 }
316 catch (std::invalid_argument const& arg)
317 {
318 sample::gLogError << arg.what() << std::endl;
319 failed = true;
320 }
321
322 if (failed)
323 {
324 AllOptions::help(std::cout);
325 return sample::gLogger.reportFail(sampleTest);
326 }
327 }
328 else
329 {
330 options.helps = true;
331 }
332
333 if (options.helps)
334 {
335 AllOptions::help(std::cout);
336 return sample::gLogger.reportPass(sampleTest);
337 }
338

Callers

nothing calls this directly

Calls 15

argsToArgumentsMapFunction · 0.85
parseHelpFunction · 0.85
setCudaDeviceFunction · 0.85
loadLibraryFunction · 0.85
hasSafeRuntimeFunction · 0.85
getEngineBuildEnvFunction · 0.85
dumpRefittableFunction · 0.85
timeRefitFunction · 0.85
printLayerInfoFunction · 0.85
timeDeserializeFunction · 0.85
getCudaDriverVersionFunction · 0.85
getCudaRuntimeVersionFunction · 0.85

Tested by

no test coverage detected