MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / main

Function main

examples/cpp/bert_fp8/bert_fp8_example.cc:117–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117int main(int argc, char** argv)
118{
119 if (argc < 8 || argc > 10) {
120 FT_LOG_ERROR("bert_example batch_size num_layers seq_len head_num size_per_head is_remove_padding thread_num");
121 FT_LOG_ERROR("e.g., ./bin/bert_example 32 12 32 12 64 0 1");
122 return 0;
123 }
124
125 int batch_size = atoi(argv[1]);
126 int num_layers = atoi(argv[2]);
127 int seq_len = atoi(argv[3]);
128 int head_num = atoi(argv[4]);
129 int size_per_head = atoi(argv[5]);
130 bool is_remove_padding = static_cast<bool>(atoi(argv[6]));
131 const int thread_num = atoi(argv[7]);
132 std::string model_path = argc >= 9 ? std::string(argv[8]) : "";
133 const float mean_rel_diff_threshold = argc >= 10 ? atof(argv[9]) : -1.0f;
134
135 std::vector<std::thread> threads;
136 threads.clear();
137
138 for (int i = 0; i < thread_num; i++) {
139 threads.push_back(std::thread(bertExample<__nv_fp8_e4m3, __nv_bfloat16>,
140 batch_size,
141 num_layers,
142 seq_len,
143 head_num,
144 size_per_head,
145 is_remove_padding,
146 model_path,
147 mean_rel_diff_threshold));
148 }
149 for (auto& t : threads) {
150 t.join();
151 }
152
153 return 0;
154}
155
156template<typename T1, typename T2>
157int bertExample(size_t batch_size,

Callers

nothing calls this directly

Calls 1

clearMethod · 0.80

Tested by

no test coverage detected