| 8 | #include <iostream> |
| 9 | |
| 10 | int main(int argc, char** argv) { |
| 11 | bool success = false; |
| 12 | try { |
| 13 | LightGBM::Application app(argc, argv); |
| 14 | app.Run(); |
| 15 | |
| 16 | #ifdef USE_MPI |
| 17 | LightGBM::Linkers::MpiFinalizeIfIsParallel(); |
| 18 | #endif |
| 19 | |
| 20 | success = true; |
| 21 | } |
| 22 | catch (const std::exception& ex) { |
| 23 | std::cerr << "Met Exceptions:" << std::endl; |
| 24 | std::cerr << ex.what() << std::endl; |
| 25 | } |
| 26 | catch (const std::string& ex) { |
| 27 | std::cerr << "Met Exceptions:" << std::endl; |
| 28 | std::cerr << ex << std::endl; |
| 29 | } |
| 30 | catch (...) { |
| 31 | std::cerr << "Unknown Exceptions" << std::endl; |
| 32 | } |
| 33 | |
| 34 | if (!success) { |
| 35 | #ifdef USE_MPI |
| 36 | LightGBM::Linkers::MpiAbortIfIsParallel(); |
| 37 | #endif |
| 38 | |
| 39 | exit(-1); |
| 40 | } |
| 41 | } |