return values in Init and Finalize (#96)

* make inti function return values

* address the comments
This commit is contained in:
Nan Zhu
2019-06-25 20:05:54 -07:00
committed by GitHub
parent fc85f776f4
commit 65b718a5e7
12 changed files with 253 additions and 201 deletions

View File

@@ -32,14 +32,16 @@ typedef unsigned long rbt_ulong; // NOLINT(*)
* from environment variables.
* \param argc number of arguments in argv
* \param argv the array of input arguments
* \return true if rabit is initialized successfully otherwise false
*/
RABIT_DLL void RabitInit(int argc, char *argv[]);
RABIT_DLL bool RabitInit(int argc, char *argv[]);
/*!
* \brief finalize the rabit engine,
* call this function after you finished all jobs.
* \return true if rabit is initialized successfully otherwise false
*/
RABIT_DLL void RabitFinalize(void);
RABIT_DLL bool RabitFinalize(void);
/*!
* \brief get rank of current process

View File

@@ -161,9 +161,9 @@ class IEngine {
};
/*! \brief initializes the engine module */
void Init(int argc, char *argv[]);
bool Init(int argc, char *argv[]);
/*! \brief finalizes the engine module */
void Finalize(void);
bool Finalize(void);
/*! \brief singleton method to get engine */
IEngine *GetEngine(void);

View File

@@ -103,12 +103,12 @@ inline void Reducer(const void *src_, void *dst_, int len, const MPI::Datatype &
} // namespace op
// intialize the rabit engine
inline void Init(int argc, char *argv[]) {
engine::Init(argc, argv);
inline bool Init(int argc, char *argv[]) {
return engine::Init(argc, argv);
}
// finalize the rabit engine
inline void Finalize(void) {
engine::Finalize();
inline bool Finalize(void) {
return engine::Finalize();
}
// get the rank of current process
inline int GetRank(void) {

View File

@@ -73,12 +73,14 @@ struct BitOR;
* \brief initializes rabit, call this once at the beginning of your program
* \param argc number of arguments in argv
* \param argv the array of input arguments
* \return true if initialized successfully, otherwise false
*/
inline void Init(int argc, char *argv[]);
inline bool Init(int argc, char *argv[]);
/*!
* \brief finalizes the rabit engine, call this function after you finished with all the jobs
* \return true if finalized successfully, otherwise false
*/
inline void Finalize();
inline bool Finalize();
/*! \brief gets rank of the current process
* \return rank number of worker*/
inline int GetRank();