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

Function main

examples/cpp/multi_gpu_gpt/multi_gpu_gpt_async_example.cc:403–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

401void multi_gpu_gpt_example(const INIReader reader);
402
403int main(int argc, char* argv[])
404{
405 mpi::initialize(&argc, &argv);
406 srand(0);
407
408 std::string ini_name;
409 if (argc >= 2) {
410 ini_name = std::string(argv[1]);
411 }
412 else {
413 ini_name = "../examples/cpp/multi_gpu_gpt/gpt_config.ini";
414 }
415 std::cout << "[INFO] Configuration file path: " << ini_name << std::endl;
416
417 if (argc >= 3) {
418 USE_ASYNC = std::atoi(argv[2]) == 1;
419 }
420 if (USE_ASYNC) {
421 std::cout << "[INFO] Enable async forward" << std::endl;
422 }
423 else {
424 std::cout << "[INFO] Disable async forward" << std::endl;
425 }
426
427 INIReader reader = INIReader(ini_name);
428 if (reader.ParseError() < 0) {
429 std::cout << "[ERROR] Can't load '" << ini_name << "'\n";
430 return -1;
431 }
432 const std::string data_type = reader.Get("ft_instance_hyperparameter", "data_type");
433
434 if (data_type == "fp32") {
435 multi_gpu_gpt_example<float>(reader);
436 }
437 else if (data_type == "fp16") {
438 multi_gpu_gpt_example<half>(reader);
439 }
440#ifdef ENABLE_BF16
441 else if (data_type == "bf16") {
442 multi_gpu_gpt_example<__nv_bfloat16>(reader);
443 }
444#endif
445 else {
446 printf("[ERROR] data_type should be fp32, fp16 or bf16 ! \n");
447 return -1;
448 }
449 mpi::finalize();
450 return 0;
451}

Callers

nothing calls this directly

Calls 4

initializeFunction · 0.85
INIReaderClass · 0.85
ParseErrorMethod · 0.80
GetMethod · 0.80

Tested by

no test coverage detected