xref: /aosp_15_r20/external/pytorch/binaries/benchmark_args.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 /**
2  * Copyright (c) 2016-present, Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include "c10/util/Flags.h"
19 
20 C10_DEFINE_string(
21     backend,
22     "builtin",
23     "The backend to use when running the model. The allowed "
24     "backend choices are: builtin, default, nnpack, eigen, mkl, cuda");
25 
26 C10_DEFINE_string(init_net, "", "The given net to initialize any parameters.");
27 C10_DEFINE_string(
28     input,
29     "",
30     "Input that is needed for running the network. If "
31     "multiple input needed, use comma separated string.");
32 C10_DEFINE_string(
33     input_dims,
34     "",
35     "Alternate to input_files, if all inputs are simple "
36     "float TensorCPUs, specify the dimension using comma "
37     "separated numbers. If multiple input needed, use "
38     "semicolon to separate the dimension of different "
39     "tensors.");
40 C10_DEFINE_string(
41     input_file,
42     "",
43     "Input file that contain the serialized protobuf for "
44     "the input blobs. If multiple input needed, use comma "
45     "separated string. Must have the same number of items "
46     "as input does.");
47 C10_DEFINE_string(
48     input_type,
49     "float",
50     "Input type when specifying the input dimension."
51     "The supported types are float, uint8_t.");
52 C10_DEFINE_int(iter, 10, "The number of iterations to run.");
53 C10_DEFINE_bool(
54     measure_memory,
55     false,
56     "Whether to measure increase in allocated memory while "
57     "loading and running the net.");
58 C10_DEFINE_string(net, "", "The given net to benchmark.");
59 C10_DEFINE_string(
60     output,
61     "",
62     "Output that should be dumped after the execution "
63     "finishes. If multiple outputs are needed, use comma "
64     "separated string. If you want to dump everything, pass "
65     "'*' as the output value.");
66 C10_DEFINE_string(
67     output_folder,
68     "",
69     "The folder that the output should be written to. This "
70     "folder must already exist in the file system.");
71 C10_DEFINE_bool(
72     run_individual,
73     false,
74     "Whether to benchmark individual operators.");
75 C10_DEFINE_int(
76     sleep_before_run,
77     0,
78     "The seconds to sleep before starting the benchmarking.");
79 C10_DEFINE_int(
80     sleep_between_iteration,
81     0,
82     "The seconds to sleep between the individual iterations.");
83 C10_DEFINE_int(
84     sleep_between_net_and_operator,
85     0,
86     "The seconds to sleep between net and operator runs.");
87 C10_DEFINE_bool(
88     text_output,
89     false,
90     "Whether to write out output in text format for regression purpose.");
91 C10_DEFINE_int(warmup, 0, "The number of iterations to warm up.");
92 C10_DEFINE_bool(
93     wipe_cache,
94     false,
95     "Whether to evict the cache before running network.");
96