Commit 327fb820 by xiaotong

updates of XLeader

parent 13380048
......@@ -39,6 +39,8 @@ namespace nts {
/* constructor */
XLeader::XLeader()
{
id = -1;
dataLoader = NULL;
}
/* de-constructor */
......@@ -58,4 +60,11 @@ int XLeader::GetID()
return id;
}
/* set the data loader */
void XLeader::SetDataLoader(DataLoaderBase* myDataLoader)
{
CheckNTErrors(myDataLoader != NULL, "The input of XLeader::SetDataLoader should not be NULL!");
dataLoader = myDataLoader;
}
} /* end of the nts (NiuTrans.Tensor) namespace */
\ No newline at end of file
......@@ -35,8 +35,19 @@
#ifndef __XLEADER_H__
#define __XLEADER_H__
#include "XNetTemplate.h"
namespace nts { // namespace nts(NiuTrans.Tensor)
/*
conmmunication mode of a leader. This offers a way of organizing a hierachy of the work
1) run as a standalone program
2) give orders to another leader (probably remote)
3) recieve orders from anothe leader (probably remote)
4) give (and recieve) orders to (and from) different leaders
*/
enum XLEADER_MODE { XLEADER_STANDALONE, XLEADER_SEND, XLEADER_RECIEVE, XLEADER_SEND_AND_RECIEVE };
/* a leader who manages workers */
class XLeader
{
......@@ -44,6 +55,10 @@ protected:
/* id of the leader */
int id;
/* data loader */
DataLoaderBase* dataLoader;
public:
/* constructor */
XLeader();
......@@ -58,7 +73,8 @@ public:
int GetID();
/* set the data loader */
void SetDataLoader();
void SetDataLoader(DataLoaderBase * myDataLoader);
};
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论