NOLINT
| 1003 | |
| 1004 | using namespace migraphx::driver; // NOLINT |
| 1005 | int main(int argc, const char* argv[], const char* envp[]) |
| 1006 | { |
| 1007 | std::vector<std::string> args(argv + 1, argv + argc); |
| 1008 | // no argument, print the help infomration by default |
| 1009 | if(args.empty()) |
| 1010 | { |
| 1011 | args.push_back("-h"); |
| 1012 | } |
| 1013 | |
| 1014 | auto&& m = get_commands(); |
| 1015 | auto cmd = args.front(); |
| 1016 | |
| 1017 | if(cmd == "--ort-sha") |
| 1018 | { |
| 1019 | std::cout << MIGRAPHX_ORT_SHA1 << std::endl; |
| 1020 | return 0; |
| 1021 | } |
| 1022 | if(cmd == "-v" or cmd == "--version") |
| 1023 | { |
| 1024 | std::cout << get_version() << std::endl; |
| 1025 | return 0; |
| 1026 | } |
| 1027 | |
| 1028 | if(m.count(cmd) > 0) |
| 1029 | { |
| 1030 | std::string driver_invocation = |
| 1031 | std::string(argv[0]) + " " + migraphx::to_string_range(args, " "); |
| 1032 | std::cout << "Running [ " << get_version() << " ]: " << driver_invocation << std::endl; |
| 1033 | |
| 1034 | // Print start timestamp |
| 1035 | auto start_time = std::chrono::system_clock::now(); |
| 1036 | std::cout << "[" << get_formatted_timestamp(start_time) << "]" << std::endl; |
| 1037 | |
| 1038 | m.at(cmd)(argv[0], |
| 1039 | {args.begin() + 1, args.end()}); // run driver command found in commands map |
| 1040 | |
| 1041 | // Dump all the MIGraphX (consumed) Environment Variables: |
| 1042 | const auto mgx_env_map = migraphx::get_all_envs(); |
| 1043 | for(auto&& [k, v] : mgx_env_map) |
| 1044 | std::cout << k << "=" << v << "\\ \n"; // backslash(s) to facilitate cut-n-paste |
| 1045 | |
| 1046 | auto unused_envs = get_unrecognized_migraphx_envs(envp, mgx_env_map); |
| 1047 | for(auto&& e : unused_envs) |
| 1048 | std::cout << "Unused environment variable: " << e << "\n"; |
| 1049 | |
| 1050 | // Print end timestamp |
| 1051 | auto end_time = std::chrono::system_clock::now(); |
| 1052 | std::cout << "[" << get_formatted_timestamp(end_time) << "]" << std::endl; |
| 1053 | |
| 1054 | // Print total duration |
| 1055 | auto duration = |
| 1056 | std::chrono::duration_cast<std::chrono::duration<double>>(end_time - start_time); |
| 1057 | std::cout << "[ " << get_version() << " ] Complete(" << duration.count() |
| 1058 | << "s): " << driver_invocation << std::endl; |
| 1059 | } |
| 1060 | else |
| 1061 | { |
| 1062 | run_command<main_command>(argv[0], args); |
nothing calls this directly
no test coverage detected