diff --git a/src_cpp/opennnBridge/worker_definitions_ag.h b/src_cpp/opennnBridge/worker_definitions_ag.h index 5e57d143..91ffd4c5 100644 --- a/src_cpp/opennnBridge/worker_definitions_ag.h +++ b/src_cpp/opennnBridge/worker_definitions_ag.h @@ -1,7 +1,7 @@ #pragma once // This file was auto generated -#define NERLPLANNER_VERSION "1.0.0" +// Generated by Nerlplanner version: 1.0.0 enum LayerTypeEnum{LAYER_TYPE_DEFAULT=0,LAYER_TYPE_SCALING=1,LAYER_TYPE_CNN=2,LAYER_TYPE_PERCEPTRON=3,LAYER_TYPE_POOLING=4,LAYER_TYPE_PROBABILISTIC=5,LAYER_TYPE_LSTM=6,LAYER_TYPE_RECCURRENT=7,LAYER_TYPE_UNSCALING=8,LAYER_TYPE_BOUNDING=9}; enum ProbabilisticActivationEnum{PROBABILISTIC_ACTIVATION_BINARY=1,PROBABILISTIC_ACTIVATION_LOGISTIC=2,PROBABILISTIC_ACTIVATION_COMPETITIVE=3,PROBABILISTIC_ACTIVATION_SOFTMAX=4}; diff --git a/src_erl/NerlnetApp/src/worker_definitions_ag.hrl b/src_erl/NerlnetApp/src/worker_definitions_ag.hrl index d716bce7..6b7b4724 100644 --- a/src_erl/NerlnetApp/src/worker_definitions_ag.hrl +++ b/src_erl/NerlnetApp/src/worker_definitions_ag.hrl @@ -1,5 +1,5 @@ % This is an auto generated .hrl file --define(NERLPLANNER_VERSION,"1.0.0"). +% Generated by Nerlplanner version: 1.0.0 -define(KEY_MODEL_TYPE,modelType). -define(KEY_LAYER_SIZES_LIST,layersSizes). diff --git a/src_py/nerlPlanner/CppHeadersExporter.py b/src_py/nerlPlanner/CppHeadersExporter.py index 7c052962..a4ff000c 100644 --- a/src_py/nerlPlanner/CppHeadersExporter.py +++ b/src_py/nerlPlanner/CppHeadersExporter.py @@ -19,7 +19,7 @@ def gen_header_worker_parameters_definitions(header_path : str, debug : bool = F gen_header_exporter_logger(pragma_once.generate_code()) auto_generated_header = AutoGeneratedHeader() gen_header_exporter_logger(auto_generated_header.generate_code()) - nerlplanner_version = Definition('NERLPLANNER_VERSION', f'"{NERLPLANNER_VERSION}"') + nerlplanner_version = Comment(f'Generated by Nerlplanner version: {NERLPLANNER_VERSION}') layer_type_enums = EnumType('LayerTypeEnum', LayerTypeMap, True, 'LAYER_TYPE') gen_header_exporter_logger(layer_type_enums.generate_code()) diff --git a/src_py/nerlPlanner/CppHeadersExporterDefs.py b/src_py/nerlPlanner/CppHeadersExporterDefs.py index f80b83f8..e40a175b 100644 --- a/src_py/nerlPlanner/CppHeadersExporterDefs.py +++ b/src_py/nerlPlanner/CppHeadersExporterDefs.py @@ -1,5 +1,12 @@ from collections import OrderedDict +class Comment(): + def __init__(self, comment : str) -> None: + self.comment = comment + + def generate_code(self): + return f'// {self.comment}\n' + class AutoGeneratedHeader: def __init__(self) -> None: pass diff --git a/src_py/nerlPlanner/ErlHeadersExporter.py b/src_py/nerlPlanner/ErlHeadersExporter.py index 3196ce98..ba697cee 100644 --- a/src_py/nerlPlanner/ErlHeadersExporter.py +++ b/src_py/nerlPlanner/ErlHeadersExporter.py @@ -18,7 +18,7 @@ def gen_worker_fields_hrl(header_path : str, debug : bool = False): auto_generated_header = AutoGeneratedHeader() gen_erlang_exporter_logger(auto_generated_header.generate_code()) - nerlplanner_version = Definition('NERLPLANNER_VERSION', f'"{NERLPLANNER_VERSION}"') + nerlplanner_version = Comment(f'Generated by Nerlplanner version: {NERLPLANNER_VERSION}') gen_erlang_exporter_logger(nerlplanner_version.generate_code()) fields_list_vals = [KEY_MODEL_TYPE, KEY_LAYER_SIZES_LIST, @@ -43,7 +43,17 @@ def gen_worker_fields_hrl(header_path : str, debug : bool = False): f.write(EMPTY_LINE) [f.write(x.generate_code()) for x in fields_list_defs] +def gen_dc_fields_hrl(header_path : str, debug : bool = False): + global DEBUG + DEBUG = debug + + auto_generated_header = AutoGeneratedHeader() + gen_erlang_exporter_logger(auto_generated_header.generate_code()) + + nerlplanner_version = Comment(f'Generated by Nerlplanner version: {NERLPLANNER_VERSION}') + gen_erlang_exporter_logger(nerlplanner_version.generate_code()) + #TODO def main(): @@ -52,6 +62,7 @@ def main(): parser.add_argument('-d', '--debug', help='debug mode', action='store_true') args = parser.parse_args() gen_worker_fields_hrl(args.output, args.debug) + gen_dc_fields_hrl(args.output, args.debug) if __name__=="__main__": main() diff --git a/src_py/nerlPlanner/ErlHeadersExporterDefs.py b/src_py/nerlPlanner/ErlHeadersExporterDefs.py index 8878e55c..47ed5fb4 100644 --- a/src_py/nerlPlanner/ErlHeadersExporterDefs.py +++ b/src_py/nerlPlanner/ErlHeadersExporterDefs.py @@ -2,6 +2,13 @@ # Generates automated Erlang code! +class Comment(): + def __init__(self, comment : str) -> None: + self.comment = comment + + def generate_code(self): + return f'% {self.comment}\n' + class AutoGeneratedHeader: def __init__(self) -> None: pass diff --git a/src_py/nerlPlanner/JsonDistributedConfig.py b/src_py/nerlPlanner/JsonDistributedConfig.py index 27b8b6f7..5d8a8028 100644 --- a/src_py/nerlPlanner/JsonDistributedConfig.py +++ b/src_py/nerlPlanner/JsonDistributedConfig.py @@ -2,6 +2,7 @@ from JsonElements import * from collections import OrderedDict from JsonElementWorker import * +from JsonDistributedConfigDefs import * import json @@ -9,19 +10,6 @@ # from collections import OrderedDict #values=json.loads(jsontext,object_pairs_hook=OrderedDict) -KEY_NERLNET_SETTINGS = "NerlNetSettings" -KEY_FREQUENCY = "frequency" -KEY_BATCH_SIZE = "batchSize" -KEY_DEVICES = "devices" -KEY_CLIENTS = "clients" -KEY_WORKERS = "workers" -KEY_MODEL_SHA = "model-sha" -KEY_SOURCES = "sources" -KEY_ROUTERS = "routers" - -NAME_FIELD = "name" -WORKER_MODEL_SHA_FIELD = "model-sha" - class JsonDistributedConfig(): def __init__(self): self.main_dict = OrderedDict() diff --git a/src_py/nerlPlanner/JsonDistributedConfigDefs.py b/src_py/nerlPlanner/JsonDistributedConfigDefs.py new file mode 100644 index 00000000..f80e66d3 --- /dev/null +++ b/src_py/nerlPlanner/JsonDistributedConfigDefs.py @@ -0,0 +1,13 @@ + +KEY_NERLNET_SETTINGS = "NerlNetSettings" +KEY_FREQUENCY = "frequency" +KEY_BATCH_SIZE = "batchSize" +KEY_DEVICES = "devices" +KEY_CLIENTS = "clients" +KEY_WORKERS = "workers" +KEY_MODEL_SHA = "model-sha" +KEY_SOURCES = "sources" +KEY_ROUTERS = "routers" + +NAME_FIELD = "name" +WORKER_MODEL_SHA_FIELD = "model-sha" \ No newline at end of file