main.cpp 936 Bytes
Newer Older
1
2
3
4
/*!
 * Copyright (c) 2016 Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See LICENSE file in the project root for license information.
 */
5
#include <LightGBM/application.h>
Guolin Ke's avatar
Guolin Ke committed
6

7
8
#include <iostream>

9
10
11
#ifdef USE_MPI
  #include "network/linkers.h"
#endif
12

Guolin Ke's avatar
Guolin Ke committed
13
int main(int argc, char** argv) {
14
  bool success = false;
15
16
17
  try {
    LightGBM::Application app(argc, argv);
    app.Run();
18
19
20
21
22
23

#ifdef USE_MPI
    LightGBM::Linkers::MpiFinalizeIfIsParallel();
#endif

    success = true;
24
25
26
27
28
29
30
31
32
33
34
  }
  catch (const std::exception& ex) {
    std::cerr << "Met Exceptions:" << std::endl;
    std::cerr << ex.what() << std::endl;
  }
  catch (const std::string& ex) {
    std::cerr << "Met Exceptions:" << std::endl;
    std::cerr << ex << std::endl;
  }
  catch (...) {
    std::cerr << "Unknown Exceptions" << std::endl;
35
36
37
38
39
40
41
  }

  if (!success) {
#ifdef USE_MPI
    LightGBM::Linkers::MpiAbortIfIsParallel();
#endif

42
43
    exit(-1);
  }
44
}