[
https://issues.apache.org/jira/browse/SINGA-502?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Chris Yeung resolved SINGA-502.
-------------------------------
Resolution: Fixed
> Avoid moving data between host and gpu devices in some operations
> -----------------------------------------------------------------
>
> Key: SINGA-502
> URL: https://issues.apache.org/jira/browse/SINGA-502
> Project: Singa
> Issue Type: Improvement
> Components: Core
> Reporter: Chris Yeung
> Priority: Major
> Time Spent: 40m
> Remaining Estimate: 0h
>
> Some functions move data between GPU and host memory, which should be fixed
> for many reasons such as efficiency and asynchronization (and buffering
> operation in the future). For example:
> The softmax_cross_entropy move to data to host and then back to gpu, so the
> whole function needed to be changed:
> class SoftMaxCrossEntropy(Operation):
> def __init__(self, t):
> super(SoftMaxCrossEntropy, self).__init__()
> self.t = t.data
> def forward(self, x):
> self.p = singa.SoftMax(x)
> loss = CTensor((1,), self.p.device())
> ret = singa.CrossEntropyFwd(self.p, self.t)
> loss.SetFloatValue(singa.SumAsFloat(ret) / x.shape()[0])
> return loss
> Here the SumAsFloat return a c++ float value, and this value is read back to
> gpu in the SetFloatValue function.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)