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