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
6
#include <LightGBM/application.h>

7
8
#include <iostream>

9
10
#include "network/linkers.h"

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

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

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

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

40
41
    exit(-1);
  }
42
}