Commit b87c6f74 by xiaotong

add FlushToDevice()

parent 450872fc
...@@ -1986,6 +1986,19 @@ void XTensor::FlushToMem(XMem* targetMem) ...@@ -1986,6 +1986,19 @@ void XTensor::FlushToMem(XMem* targetMem)
} }
/* /*
flush the data to the target device (with id)
>> myDevID - id of the target device
*/
void XTensor::FlushToDevice(int myDevID)
{
if (myDevID == devID)
return;
XMem * myMem = GMems.GetMem(myDevID);
FlushToMem(myMem);
}
/*
allocate the memory space of the tensor (in the global memory) allocate the memory space of the tensor (in the global memory)
>> tensor - the tensor we intend to process >> tensor - the tensor we intend to process
>> myMem - the memory pool we are using >> myMem - the memory pool we are using
......
...@@ -457,6 +457,9 @@ public: ...@@ -457,6 +457,9 @@ public:
/* flush the data to the target device */ /* flush the data to the target device */
void FlushToMem(XMem * targetMem); void FlushToMem(XMem * targetMem);
/* flush the data to the target device (with id) */
void FlushToDevice(int myDevID);
/* allocate the memory space of the tensor (in the global memory) */ /* allocate the memory space of the tensor (in the global memory) */
static static
void AllocateData(XTensor * tensor, XMem * myMem = NULL, bool useBuf = false); void AllocateData(XTensor * tensor, XMem * myMem = NULL, bool useBuf = false);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论