MCPcopy Create free account
hub / github.com/alibaba/MNN / main

Function main

tools/cpp/timeProfile.cpp:41–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39 return result;
40}
41int main(int argc, const char* argv[]) {
42 if (argc < 2) {
43 MNN_PRINT("=========================================================================================\n");
44 MNN_PRINT("Arguments: model.MNN runLoops forwardType inputSize numberThread precision sparsity cpuIds\n");
45 MNN_PRINT("Example: %s model.MNN 100 0 1x3x224x224 4 0 0 0,1,2,3\n", argv[0]);
46 MNN_PRINT("=========================================================================================\n");
47 return -1;
48 }
49
50 std::string cmd = argv[0];
51 std::string pwd = "./";
52 auto rslash = cmd.rfind("/");
53 if (rslash != std::string::npos) {
54 pwd = cmd.substr(0, rslash + 1);
55 }
56
57 // read args
58 const char* fileName = argv[1];
59 int runTime = 100;
60 if (argc > 2) {
61 runTime = ::atoi(argv[2]);
62 }
63 auto type = MNN_FORWARD_CPU;
64 if (argc > 3) {
65 type = (MNNForwardType)atoi(argv[3]);
66 printf("Use extra forward type: %d\n", type);
67 }
68
69 // input dims
70 std::vector<int> inputDims;
71 if (argc > 4) {
72 inputDims = parseIntList(argv[4], 'x');
73 }
74 MNN_PRINT("inputDims: ");
75 for (auto dim : inputDims) {
76 MNN_PRINT("%d ", dim);
77 }
78 MNN_PRINT("\n");
79 int threadNumber = 4;
80 if (argc > 5) {
81 threadNumber = ::atoi(argv[5]);
82 MNN_PRINT("Set ThreadNumber = %d\n", threadNumber);
83 }
84
85 auto precision = BackendConfig::PrecisionMode::Precision_Normal;
86 if (argc > 6) {
87 precision = (BackendConfig::PrecisionMode)atoi(argv[6]);
88 printf("Use precision type: %d\n", precision);
89 }
90
91 float sparsity = 0.0f;
92 if(argc > 7) {
93 sparsity = atof(argv[7]);
94 }
95
96 // CPU IDs
97 std::vector<int> cpuIds;
98 if (argc > 8) {

Callers

nothing calls this directly

Calls 15

rfindMethod · 0.80
substrMethod · 0.80
getBufferSizeMethod · 0.80
setSessionModeMethod · 0.80
setSessionHintMethod · 0.80
getSessionInputMethod · 0.80
resizeTensorMethod · 0.80
resizeSessionMethod · 0.80
getDimensionTypeMethod · 0.80
copyFromHostTensorMethod · 0.80
releaseModelMethod · 0.80
getSessionOutputMethod · 0.80

Tested by

no test coverage detected