Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
The Blob class is adapted from Caffe's code.
It supports both GPU and CPU by providing classes like
gpu_data(); cpu_data();
For GPU mode, users call gpu_data(); For CPU mode, users' code call cpu_data. Hence, users have to write two pieces of code (one for GPU and one for CPU).
To avoid code redundancy, SINGA adds one function in Blob class
xpu_data();
xpu is cpu or gpu and is defined at compile time.
Users write one piece of code which calls xpu_data() to get data from Blob. Depending on the compilation option, it will return GPU data or CPU data. This ticket just replaces the cpu to xpu and test with xpu=cpu. The GPU support (i.e., xpu=gpu) will be added in next release.
The disadvantage of using xpu is that users cannot choose the running mode after compilation, and have to decide the running mode at compile time.