You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@singa.apache.org by "wangwei (JIRA)" <ji...@apache.org> on 2015/10/10 11:40:05 UTC
[jira] [Created] (SINGA-86) Register new Layer/Updater/etc using
macro
wangwei created SINGA-86:
----------------------------
Summary: Register new Layer/Updater/etc using macro
Key: SINGA-86
URL: https://issues.apache.org/jira/browse/SINGA-86
Project: Singa
Issue Type: Improvement
Reporter: wangwei
To make the code modular, SINGA provides base classes for Layer/Updater/etc. New implementations are registered via Driver::RegisterLayer, Driver::RegisterUpdater, etc. Consequently, driver.cc has to include all subclasses, leading to a long include list. Everytime, we add a new implementation (i.e.,a new subclass), we need to change the driver.cc to register this new subclass.
This ticket is going to create macros for register Layer (e.g., RegisterLayer) Updater (e.g., RegisterUpdater), etc. These macros are called in the xxxlayer.cc file. Particularly, the RegisterLayer macro defines a static instance of LayerRegister, e.g.,
RegisterLayer(FooLayer), which is equivalent to
{code}
static LayerRegister<FooLayer> foolayer_registry;
{code}
The constructor would register the layer creator into a global map as
{code}
template<typename LayerType>
class LayerRegister {
public:
LayerRegister() {
// call Factory<LayerType> to register the creator of the layer into a global map.
}
};
{code}
Correspondingly, we can create macros for other classes, e.g., Updater, LRGenerator.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)