40 lines
925 B
C++
40 lines
925 B
C++
/*!
|
|
* \file engine.cc
|
|
* \brief this file governs which implementation of engine we are actually using
|
|
* provides an singleton of engine interface
|
|
*
|
|
* \author Tianqi Chen, Ignacio Cano, Tianyi Zhou
|
|
*/
|
|
#define _CRT_SECURE_NO_WARNINGS
|
|
#define _CRT_SECURE_NO_DEPRECATE
|
|
#define NOMINMAX
|
|
|
|
#include "./engine.h"
|
|
#include "./engine_base.h"
|
|
#include "./engine_robust.h"
|
|
|
|
namespace engine {
|
|
// singleton sync manager
|
|
AllReduceRobust manager;
|
|
|
|
/*! \brief intiialize the synchronization module */
|
|
void Init(int argc, char *argv[]) {
|
|
for (int i = 1; i < argc; ++i) {
|
|
char name[256], val[256];
|
|
if (sscanf(argv[i], "%[^=]=%s", name, val) == 2) {
|
|
manager.SetParam(name, val);
|
|
}
|
|
}
|
|
manager.Init();
|
|
}
|
|
|
|
/*! \brief finalize syncrhonization module */
|
|
void Finalize(void) {
|
|
manager.Shutdown();
|
|
}
|
|
/*! \brief singleton method to get engine */
|
|
IEngine *GetEngine(void) {
|
|
return &manager;
|
|
}
|
|
} // namespace engine
|