main.cpp 912 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.
 */
Guolin Ke's avatar
Guolin Ke committed
5
#include <LightGBM/application.h>
6
#include "network/linkers.h"
Guolin Ke's avatar
Guolin Ke committed
7

8
9
#include <iostream>

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

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

    success = true;
21
22
23
24
25
26
27
28
29
30
31
  }
  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;
32
33
34
35
36
37
38
  }

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

39
40
    exit(-1);
  }
41
 }