fix rabit for single node without initialization

This commit is contained in:
tqchen 2014-12-21 04:35:32 -08:00
parent e40047f9c2
commit cfea4dbe85
2 changed files with 4 additions and 1 deletions

View File

@ -21,7 +21,7 @@ AllreduceBase::AllreduceBase(void) {
host_uri = ""; host_uri = "";
slave_port = 9010; slave_port = 9010;
nport_trial = 1000; nport_trial = 1000;
rank = -1; rank = 0;
world_size = -1; world_size = -1;
hadoop_mode = 0; hadoop_mode = 0;
version_number = 0; version_number = 0;
@ -50,6 +50,8 @@ void AllreduceBase::Init(void) {
this->SetParam("rabit_world_size", num_task); this->SetParam("rabit_world_size", num_task);
} }
} }
// clear the setting before start reconnection
this->rank = -1;
//--------------------- //---------------------
// start socket // start socket
utils::Socket::Startup(); utils::Socket::Startup();

View File

@ -58,6 +58,7 @@ class AllreduceBase : public IEngine {
} }
/*! \brief get rank */ /*! \brief get rank */
virtual int GetWorldSize(void) const { virtual int GetWorldSize(void) const {
if (world_size == -1) return 1;
return world_size; return world_size;
} }
/*! \brief get rank */ /*! \brief get rank */