forked from alibaba/MNN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
57 lines (55 loc) · 1.67 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// main.cpp
// MNN
//
// Created by MNN on 2018/07/19.
// Copyright © 2018, Alibaba Group Holding Limited
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <MNN/MNNForwardType.h>
#include <MNN/expr/Executor.hpp>
#include <string.h>
#include "MNNTestSuite.h"
#include "TestUtils.h"
int main(int argc, char* argv[]) {
if (argc == 2 && strcmp(argv[1], "--help") == 0) {
MNN_PRINT("./run_test.out [test_name] [backend] [precision] [thread/mode] [flag]\n");
MNN_PRINT("\t backend: 0 - CPU (default), 3 - OpenCL\n");
MNN_PRINT("\t precision: 0 - Normal, 1 - High (default), 2 - Low\n");
return 0;
}
int precision = (int)MNN::BackendConfig::Precision_High;
int thread = 1;
const char* flag = "";
if (argc > 2) {
auto type = (MNNForwardType)atoi(argv[2]);
FUNC_PRINT(type);
if (argc > 3) {
precision = atoi(argv[3]);
}
if (argc > 4) {
thread = atoi(argv[4]);
}
if (argc > 5) {
flag = argv[5];
}
MNN::BackendConfig config;
config.precision = (MNN::BackendConfig::PrecisionMode)precision;
MNN::Express::Executor::getGlobalExecutor()->setGlobalExecutorConfig(type, config, thread);
MNN_PRINT("After update, precision in TestUtil:%d\n", precision);
}
if (argc > 1) {
auto name = argv[1];
if (strcmp(name, "all") == 0) {
return MNNTestSuite::runAll(precision, flag);
} else {
return MNNTestSuite::run(name, precision, flag);
}
} else {
return MNNTestSuite::runAll(precision, flag);
}
return 0;
}